forked from bjornblissing/osg-3rdparty-cmake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
115 lines (94 loc) · 3.05 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
CMAKE_MINIMUM_REQUIRED(VERSION 3.5 FATAL_ERROR)
PROJECT(OpenscenegraphThirdParty)
# Only enable release and debug builds
IF(CMAKE_CONFIGURATION_TYPES)
SET(CMAKE_CONFIGURATION_TYPES Debug Release)
SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING
"Reset the configurations to what we need"
FORCE)
ENDIF()
# Generate folder name for install
IF(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
SET(BITS "x64")
ELSEIF (${CMAKE_SIZEOF_VOID_P} EQUAL 4)
SET(BITS "x86")
ENDIF()
IF (MSVC)
IF (${MSVC_VERSION} EQUAL 1600)
SET(TOOLSET "v100") # Visual Studio 2010
ELSEIF (${MSVC_VERSION} EQUAL 1700)
SET(TOOLSET "v110") # Visual Studio 2012
ELSEIF (${MSVC_VERSION} EQUAL 1800)
SET(TOOLSET "v120") # Visual Studio 2013
ELSEIF (${MSVC_VERSION} EQUAL 1900)
SET(TOOLSET "v140") # Visual Studio 2015
ELSEIF (${MSVC_VERSION} GREATER 1910 AND ${MSVC_VERSION} LESS 1920)
SET(TOOLSET "v141") # Visual Studio 2017
ENDIF()
ENDIF()
IF(MINGW)
SET(TOOLSET "mingw")
ENDIF()
SET(dirname "${TOOLSET}-${BITS}")
# Set directories if not set explicitly
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/3rdParty/${dirname}" CACHE "Force change of path" PATH FORCE)
ENDIF()
SET(ZLIB_SOURCE_DIR CACHE PATH "Path where to find ZLIB source")
SET(LIBPNG_SOURCE_DIR CACHE PATH "Path where to find LIBPNG source")
SET(LIBJPEG_SOURCE_DIR CACHE PATH "Path where to find LIBJPEG source")
SET(LIBTIFF_SOURCE_DIR CACHE PATH "Path where to find LIBTIFF source")
SET(FREETYPE_SOURCE_DIR CACHE PATH "Path where to find FREETYPE source")
SET(GLUT_SOURCE_DIR CACHE PATH "Path where to find GLUT source")
SET(GIFLIB_SOURCE_DIR CACHE PATH "Path where to find GIFLIB source")
SET(MINIZIP_SOURCE_DIR CACHE PATH "Path where to find MINIZIP source")
SET(CURL_SOURCE_DIR CACHE PATH "Path where to find cURL source")
# Check dependencies for LIBPNG
IF (LIBPNG_SOURCE_DIR)
IF(NOT ZLIB_SOURCE_DIR)
MESSAGE(FATAL_ERROR "Error: LIBPNG depends on ZLIB and no ZLIB path has been set")
ENDIF()
ENDIF ()
# Check dependencies for LIBTIFF
IF(LIBTIFF_SOURCE_DIR)
IF(NOT ZLIB_SOURCE_DIR)
MESSAGE(FATAL_ERROR "Error: LIBTIFF depends on ZLIB and no ZLIB path has been set")
ENDIF()
IF(NOT LIBJPEG_SOURCE_DIR)
MESSAGE(FATAL_ERROR "Error: LIBTIFF depends on LIBJPEG and no LIBJPEG path has been set")
ENDIF()
ENDIF()
# Check dependencies for MINIZIP
IF (MINIZIP_SOURCE_DIR)
IF(NOT ZLIB_SOURCE_DIR)
MESSAGE(FATAL_ERROR "Error: MINIZIP depends on ZLIB and no ZLIB path has been set")
ENDIF()
ENDIF ()
# Add libraries
IF (ZLIB_SOURCE_DIR)
ADD_SUBDIRECTORY(zlib)
ENDIF()
IF (LIBPNG_SOURCE_DIR)
ADD_SUBDIRECTORY(libpng)
ENDIF()
IF (LIBJPEG_SOURCE_DIR)
ADD_SUBDIRECTORY(libjpeg)
ENDIF()
IF (LIBTIFF_SOURCE_DIR)
ADD_SUBDIRECTORY(libtiff)
ENDIF()
IF (FREETYPE_SOURCE_DIR)
ADD_SUBDIRECTORY(freetype)
ENDIF()
IF (GLUT_SOURCE_DIR)
ADD_SUBDIRECTORY(glut)
ENDIF()
IF (GIFLIB_SOURCE_DIR)
ADD_SUBDIRECTORY(giflib)
ENDIF()
IF (MINIZIP_SOURCE_DIR)
ADD_SUBDIRECTORY(minizip)
ENDIF()
IF (CURL_SOURCE_DIR)
ADD_SUBDIRECTORY(curl)
ENDIF()