1
+
2
+ IF (WIN32 )
3
+ CMAKE_MINIMUM_REQUIRED (VERSION 2.8.2 FATAL_ERROR)
4
+ ELSE (WIN32 )
5
+ IF (APPLE )
6
+ CMAKE_MINIMUM_REQUIRED (VERSION 2.4.6 FATAL_ERROR)
7
+ IF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
8
+ MESSAGE ("Warning: A critical CMake bug exists in 2.4.6 and below. Trying to build Universal Binaries will result in a compile error that seems unrelated. Either avoid building Universal Binaries by changing the CMAKE_OSX_ARCHITECTURES field to list only your architecture, or upgrade to the current CVS version of CMake or a newer stable version if it exists." )
9
+ ENDIF (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
10
+ ELSE (APPLE )
11
+ CMAKE_MINIMUM_REQUIRED (VERSION 2.4.0 FATAL_ERROR)
12
+ ENDIF (APPLE )
13
+ ENDIF (WIN32 )
14
+
15
+ PROJECT ( libcitygml )
16
+
17
+ SET ( CMAKE_MODULE_PATH "${libcitygml_SOURCE_DIR} /CMakeModules/;${CMAKE_MODULE_PATH} " )
18
+
19
+ IF (WIN32 )
20
+
21
+ IF (MSVC )
22
+ # This option is to enable the /MP switch for Visual Studio 2005 and above compilers
23
+ OPTION (WIN32_USE_MP "Set to ON to build libcitygml with the /MP option (Visual Studio 2005 and above)." OFF )
24
+ MARK_AS_ADVANCED (WIN32_USE_MP)
25
+ IF (WIN32_USE_MP)
26
+ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
27
+ ENDIF (WIN32_USE_MP)
28
+
29
+ # More MSVC specific compilation flags
30
+ ADD_DEFINITIONS (-D_SCL_SECURE_NO_WARNINGS)
31
+ ADD_DEFINITIONS (-D_CRT_SECURE_NO_DEPRECATE)
32
+ ENDIF (MSVC )
33
+
34
+ # Both Cygwin and Msys need -DNOMINMAX ???
35
+ IF (UNIX )
36
+ ADD_DEFINITIONS (-DNOMINMAX)
37
+ ENDIF (UNIX )
38
+ ########################################################################################################
39
+ # the foolowing options are MSVC specific,
40
+ # the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
41
+ # fron bin folder without requiring installation step.
42
+ # it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
43
+ # it also use a hack to get rid of Debug and Release folder in MSVC projects
44
+ # all the .dll and .pdb are in bin and all the .lib and .exp are in lib
45
+ #
46
+ # the second option disable incremental linking in debug build , that is enabled by default by CMake
47
+ ##########################################################################################################
48
+
49
+ IF (MSVC )
50
+ # IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
51
+ # MESSAGE("Warning: disabling versioned options 2.4.6 exibits inconsintencies in .pdb naming, at least under MSVC, suggested upgrading at least to 2.4.7")
52
+ # SET(OSG_MSVC_VERSIONED_DLL OFF)
53
+ # SET(OSG_MSVC_DEBUG_INCREMENTAL_LINK ON)
54
+ # ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
55
+ OPTION (LIBCITYGML_MSVC_VERSIONED_DLL "Set to ON to build libcitygml with versioned dll names" ON )
56
+ MARK_AS_ADVANCED (LIBCITYGML_MSVC_VERSIONED_DLL)
57
+ OPTION (LIBCITYGML_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build libcitygml without incremental linking in debug (release is off by default)" ON )
58
+ MARK_AS_ADVANCED (LIBCITYGML_MSVC_DEBUG_INCREMENTAL_LINK)
59
+ IF (NOT LIBCITYGML_MSVC_DEBUG_INCREMENTAL_LINK)
60
+ SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" )
61
+ SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" )
62
+ SET (CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" )
63
+ ENDIF (NOT LIBCITYGML_MSVC_DEBUG_INCREMENTAL_LINK)
64
+ # ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
65
+ ENDIF (MSVC )
66
+ ENDIF (WIN32 )
67
+
68
+ IF (MSVC_IDE )
69
+ # From CMake 2.8.2, new way to manage output generation dirs !
70
+ # SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../")
71
+ SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR} /bin)
72
+ SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR} /bin)
73
+
74
+ SET ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR} /lib)
75
+ SET ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR} /lib)
76
+
77
+ SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR} /bin)
78
+ SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${PROJECT_BINARY_DIR} /bin)
79
+ ENDIF (MSVC_IDE )
80
+
81
+ SET (CMAKE_DEBUG_POSTFIX "d" )
82
+
83
+ # Dynamic vs Static Linking
84
+ OPTION (LIBCITYGML_DYNAMIC "Set to ON to build libcitygml for dynamic linking. Use OFF for static." OFF )
85
+ IF (LIBCITYGML_DYNAMIC)
86
+ SET (LIBCITYGML_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED" )
87
+ ELSE (LIBCITYGML_DYNAMIC)
88
+ SET (LIBCITYGML_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC" )
89
+ ENDIF (LIBCITYGML_DYNAMIC)
90
+
91
+ SET (OUTPUT_BINDIR ${PROJECT_BINARY_DIR} /bin)
92
+ MAKE_DIRECTORY (${OUTPUT_BINDIR} )
93
+ SET (EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR} )
94
+
95
+ SET (OUTPUT_LIBDIR ${PROJECT_BINARY_DIR} /lib)
96
+ MAKE_DIRECTORY (${OUTPUT_LIBDIR} )
97
+ SET (LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR} )
98
+
99
+ # IF( DEBUG_BUILD )
100
+ # SET( CMAKE_BUILD_TYPE "Debug" )
101
+ # ELSE( DEBUG_BUILD )
102
+ # SET( CMAKE_BUILD_TYPE "Release" )
103
+ # ENDIF( DEBUG_BUILD )
104
+
105
+ OPTION (LIBCITYGML_STATIC_CRT "Set to ON to link libcitygml with the multithread CRT static library (instead of DLL)." ON )
106
+
107
+ # xml library
108
+ OPTION (LIBCITYGML_USE_XERCESC "Set to ON to build libcitygml with Xerces-c library." ON )
109
+ OPTION (LIBCITYGML_USE_LIBXML2 "Set to ON to build libcitygml with LibXml2 library." OFF )
110
+
111
+ # gdal library
112
+ OPTION (LIBCITYGML_USE_GDAL "Set to ON to build libcitygml with GDAL library and support coordinates reprojections." OFF )
113
+
114
+ IF ( LIBCITYGML_USE_XERCESC )
115
+ IF ( LIBCITYGML_USE_LIBXML2 )
116
+ MESSAGE ("Error: You cannot build the library with Xerces-c AND LibXml2! Xerces library will be used by default." )
117
+ UNSET ( LIBCITYGML_USE_LIBXML2 )
118
+ ENDIF ( LIBCITYGML_USE_LIBXML2 )
119
+ ENDIF ( LIBCITYGML_USE_XERCESC )
120
+
121
+ # core
122
+ ADD_SUBDIRECTORY ( src )
123
+
124
+ # test
125
+ OPTION (LIBCITYGML_TESTS "Set to ON to build libcitygml tests programs." ON )
126
+ IF (LIBCITYGML_TESTS)
127
+ ADD_SUBDIRECTORY ( test )
128
+ ENDIF (LIBCITYGML_TESTS)
129
+
130
+ OPTION (LIBCITYGML_VRML "Set to ON to build citygml2vrml program." ON )
131
+ IF (LIBCITYGML_VRML)
132
+ ADD_SUBDIRECTORY ( test /citygml2vrml )
133
+ ENDIF (LIBCITYGML_VRML)
134
+
135
+ #-----------------------------------------------------------------------------
136
+ ### uninstall target
137
+ #-----------------------------------------------------------------------------
138
+ CONFIGURE_FILE (
139
+ "${CMAKE_CURRENT_SOURCE_DIR} /CMakeModules/cmake_uninstall.cmake.in"
140
+ "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake"
141
+ IMMEDIATE @ONLY)
142
+ ADD_CUSTOM_TARGET (uninstall
143
+ "${CMAKE_COMMAND} " -P "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake" )
0 commit comments