0029377: Configuration, CMake - linkage errors while using static OCCT libraries...
[occt.git] / adm / cmake / occt_toolkit.cmake
CommitLineData
316d77d9 1# script for each OCCT toolkit
2
fb3267c7 3# parce PACKAGES file
4if ("${PROJECT_NAME}" STREQUAL DRAWEXE)
5 set (USED_PACKAGES DRAWEXE)
6else()
7 FILE_TO_LIST ("src/${PROJECT_NAME}/PACKAGES" USED_PACKAGES)
8endif()
9
10set (PRECOMPILED_DEFS)
11
d5265175 12if (NOT BUILD_SHARED_LIBS)
13 list (APPEND PRECOMPILED_DEFS "-DOCCT_NO_PLUGINS")
77cd443b 14 if (WIN32)
15 list (APPEND PRECOMPILED_DEFS "-DHAVE_NO_DLL")
16 endif()
d5265175 17endif()
18
316d77d9 19# Get all used packages from toolkit
fb3267c7 20foreach (OCCT_PACKAGE ${USED_PACKAGES})
21
22 # TKService contains platform-dependent packages: Xw and WNT
23 if ((WIN32 AND "${OCCT_PACKAGE}" STREQUAL "Xw") OR (NOT WIN32 AND "${OCCT_PACKAGE}" STREQUAL "WNT"))
e713baee 24 # do nothing
25 else()
316d77d9 26
e713baee 27 if (WIN32)
28 list (APPEND PRECOMPILED_DEFS "-D__${OCCT_PACKAGE}_DLL")
29 endif()
316d77d9 30
e713baee 31 set (SOURCE_FILES)
32 set (HEADER_FILES)
33
34 # Generate Flex and Bison files
109aa56e 35 if (${BUILD_YACCLEX})
e713baee 36
37 # flex files
38 OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]lex" SOURCE_FILES_FLEX)
39 list (LENGTH SOURCE_FILES_FLEX SOURCE_FILES_FLEX_LEN)
40
41 # bison files
42 OCCT_ORIGIN_AND_PATCHED_FILES ("src/${OCCT_PACKAGE}" "*[.]yacc" SOURCE_FILES_BISON)
43 list (LENGTH SOURCE_FILES_BISON SOURCE_FILES_BISON_LEN)
44
45 if (${SOURCE_FILES_FLEX_LEN} EQUAL ${SOURCE_FILES_BISON_LEN} AND NOT ${SOURCE_FILES_FLEX_LEN} EQUAL 0)
46
47 list (SORT SOURCE_FILES_FLEX)
48 list (SORT SOURCE_FILES_BISON)
49
50 math (EXPR SOURCE_FILES_FLEX_LEN "${SOURCE_FILES_FLEX_LEN} - 1")
51 foreach (FLEX_FILE_INDEX RANGE ${SOURCE_FILES_FLEX_LEN})
52
53 list (GET SOURCE_FILES_FLEX ${FLEX_FILE_INDEX} CURRENT_FLEX_FILE)
54 get_filename_component (CURRENT_FLEX_FILE_NAME ${CURRENT_FLEX_FILE} NAME_WE)
55
56 list (GET SOURCE_FILES_BISON ${FLEX_FILE_INDEX} CURRENT_BISON_FILE)
57 get_filename_component (CURRENT_BISON_FILE_NAME ${CURRENT_BISON_FILE} NAME_WE)
58
59 string (COMPARE EQUAL ${CURRENT_FLEX_FILE_NAME} ${CURRENT_BISON_FILE_NAME} ARE_FILES_EQUAL)
60
61 if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
62 set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.c)
63 set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.c)
64 BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME}")
65 FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME}")
66 ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
67
68 list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})
69 endif()
70 endforeach()
71 endif()
72 endif()
316d77d9 73
e713baee 74 # header files
109aa56e 75 if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES")
76 file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
77 file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
78 file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
316d77d9 79
109aa56e 80 file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
e713baee 81 if(APPLE)
109aa56e 82 file (STRINGS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
e713baee 83 endif()
84 else()
85 file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_M REGEX ".+[.]h")
86 file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_LXX REGEX ".+[.]lxx")
87 file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" HEADER_FILES_GXX REGEX ".+[.]gxx")
316d77d9 88
e713baee 89 file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
90 if(APPLE)
91 file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/FILES" SOURCE_FILES_M REGEX ".+[.]mm")
92 endif()
316d77d9 93 endif()
e713baee 94
95 list (APPEND HEADER_FILES ${HEADER_FILES_M} ${HEADER_FILES_LXX} ${SOURCE_FILES_GXX})
96 list (APPEND SOURCE_FILES ${SOURCE_FILES_C})
f2e9c853 97 if(APPLE)
e713baee 98 list (APPEND SOURCE_FILES ${SOURCE_FILES_M})
f2e9c853 99 endif()
f2e9c853 100
e713baee 101 foreach(HEADER_FILE ${HEADER_FILES})
109aa56e 102 if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
103 message (STATUS "Info: consider patched file: ${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
104 list (APPEND USED_INCFILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
105 SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
e713baee 106 else()
107 list (APPEND USED_INCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
108 SOURCE_GROUP ("Header Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${HEADER_FILE}")
109 endif()
110 endforeach()
111
112 foreach(SOURCE_FILE ${SOURCE_FILES})
109aa56e 113 if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
114 message (STATUS "Info: consider patched file: ${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
115 list (APPEND USED_SRCFILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
116 SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${BUILD_PATCH}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
e713baee 117 else()
118 list (APPEND USED_SRCFILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
119 SOURCE_GROUP ("Source Files\\${OCCT_PACKAGE}" FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_PACKAGE}/${SOURCE_FILE}")
120 endif()
121 endforeach()
316d77d9 122 endif()
316d77d9 123endforeach()
f2e9c853 124string (REGEX REPLACE ";" " " PRECOMPILED_DEFS "${PRECOMPILED_DEFS}")
125
dfadf641 126set (USED_RCFILE "")
127if (MSVC)
128 set (USED_RCFILE "${CMAKE_BINARY_DIR}/resources/${PROJECT_NAME}.rc")
129
130 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in")
131 configure_file("${APPLY_OCCT_PATCH_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
132 else()
133 configure_file("${CMAKE_SOURCE_DIR}/adm/templates/occt_toolkit.rc.in" "${USED_RCFILE}" @ONLY)
134 endif()
135endif()
136
ada9ef40 137set (CURRENT_MODULE)
138foreach (OCCT_MODULE ${OCCT_MODULES})
139 list (FIND ${OCCT_MODULE}_TOOLKITS ${PROJECT_NAME} CURRENT_PROJECT_IS_BUILT)
140 if (NOT ${CURRENT_PROJECT_IS_BUILT} EQUAL -1)
141 set (CURRENT_MODULE ${OCCT_MODULE})
142 endif()
143endforeach()
144
145if (NOT SINGLE_GENERATOR)
146 OCCT_INSERT_CODE_FOR_TARGET ()
147endif()
148
fb3267c7 149if ("${PROJECT_NAME}" STREQUAL "DRAWEXE")
dfadf641 150 add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
fb3267c7 151
ada9ef40 152 install (TARGETS ${PROJECT_NAME}
d26375e2 153 DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
fb3267c7 154else()
dfadf641 155 add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE})
fb3267c7 156
ada9ef40 157 if (MSVC)
956d6346 158 install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
159 CONFIGURATIONS Debug RelWithDebInfo
d26375e2 160 DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
fb3267c7 161 endif()
46bd680a 162
163 if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
164 set (CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT ${CMAKE_SHARED_LIBRARY_SUFFIX})
165 set (CMAKE_SHARED_LIBRARY_SUFFIX "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
166 endif()
167
ada9ef40 168 install (TARGETS ${PROJECT_NAME}
169 EXPORT OpenCASCADE${CURRENT_MODULE}Targets
170 RUNTIME DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}"
171 ARCHIVE DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}"
172 LIBRARY DESTINATION "${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}")
46bd680a 173
174 if (NOT WIN32)
175 if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
176 set (LINK_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX_DEFAULT}")
177 set (LIBRARY_NAME "${INSTALL_DIR}/${INSTALL_DIR_LIB}\${OCCT_INSTALL_BIN_LETTER}/lib${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
178 OCCT_CREATE_SYMLINK_TO_FILE (${LIBRARY_NAME} ${LINK_NAME})
179 endif()
180 endif()
fb3267c7 181endif()
182
fb3267c7 183if (CURRENT_MODULE)
096ef695 184 set_target_properties (${PROJECT_NAME} PROPERTIES FOLDER "Modules/${CURRENT_MODULE}")
ada9ef40 185 set_target_properties (${PROJECT_NAME} PROPERTIES MODULE "${CURRENT_MODULE}")
09eca2b5 186 if (APPLE)
187 if (NOT "${INSTALL_NAME_DIR}" STREQUAL "")
188 set_target_properties (${PROJECT_NAME} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "${INSTALL_NAME_DIR}")
189 endif()
190 endif()
fb3267c7 191endif()
316d77d9 192
096ef695 193get_property (OCC_VERSION_MAJOR GLOBAL PROPERTY OCC_VERSION_MAJOR)
194get_property (OCC_VERSION_MINOR GLOBAL PROPERTY OCC_VERSION_MINOR)
195get_property (OCC_VERSION_MAINTENANCE GLOBAL PROPERTY OCC_VERSION_MAINTENANCE)
196
41c012f0 197if (ANDROID)
198 # do not append version to the filename
199 set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}")
200else()
201 set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${PRECOMPILED_DEFS}"
202 SOVERSION "${OCC_VERSION_MAJOR}"
203 VERSION "${OCC_VERSION_MAJOR}.${OCC_VERSION_MINOR}.${OCC_VERSION_MAINTENANCE}")
204endif()
fb3267c7 205
206set (USED_TOOLKITS_BY_CURRENT_PROJECT)
207set (USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT)
208
209# parce EXTERNLIB file
210FILE_TO_LIST ("src/${PROJECT_NAME}/EXTERNLIB" USED_EXTERNLIB_AND_TOOLKITS)
211foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS})
a6874708 212 string (REGEX MATCH "^ *#" COMMENT_FOUND ${USED_ITEM})
213 if (NOT COMMENT_FOUND)
214 string (REGEX MATCH "^TK" TK_FOUND ${USED_ITEM})
215 string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM})
216
5891b8ba 217 if (NOT "${TK_FOUND}" STREQUAL "")
a6874708 218 list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM})
5891b8ba 219 elseif (NOT "${VTK_FOUND}" STREQUAL "")
220 list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${USED_ITEM})
221 if (BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK)
c22e576d 222 OCCT_INSTALL_VTK(${USED_ITEM})
223 endif()
a6874708 224 else()
225 string (REGEX MATCH "^CSF_" CSF_FOUND ${USED_ITEM})
226 if ("${CSF_FOUND}" STREQUAL "")
227 message (STATUS "Info: ${USED_ITEM} from ${PROJECT_NAME} skipped due to it is empty")
228 else() # get CSF_ value
229 set (CURRENT_CSF ${${USED_ITEM}})
a20cce39 230 if (NOT "x${CURRENT_CSF}" STREQUAL "x")
4fecc365 231 set (LIBRARY_FROM_CACHE 0)
a6874708 232 separate_arguments (CURRENT_CSF)
4fecc365 233 foreach (CSF_LIBRARY ${CURRENT_CSF})
234 string (TOLOWER "${CSF_LIBRARY}" CSF_LIBRARY)
235 string (REPLACE "+" "[+]" CSF_LIBRARY "${CSF_LIBRARY}")
236 string (REPLACE "." "" CSF_LIBRARY "${CSF_LIBRARY}")
237 get_cmake_property(ALL_CACHE_VARIABLES CACHE_VARIABLES)
238 string (REGEX MATCHALL "(^|;)3RDPARTY_[^;]+_LIBRARY[^;]*" ALL_CACHE_VARIABLES "${ALL_CACHE_VARIABLES}")
239 foreach (CACHE_VARIABLE ${ALL_CACHE_VARIABLES})
240 set (CURRENT_CACHE_LIBRARY ${${CACHE_VARIABLE}})
241 string (TOLOWER "${CACHE_VARIABLE}" CACHE_VARIABLE)
242
243 if (EXISTS "${CURRENT_CACHE_LIBRARY}" AND NOT IS_DIRECTORY "${CURRENT_CACHE_LIBRARY}")
244 string (REGEX MATCH "_${CSF_LIBRARY}$" IS_ENDING "${CACHE_VARIABLE}")
245 string (REGEX MATCH "^([a-z]+)" CSF_WO_VERSION "${CSF_LIBRARY}")
246 string (REGEX MATCH "_${CSF_WO_VERSION}$" IS_ENDING_WO_VERSION "${CACHE_VARIABLE}")
247 if ("3rdparty_${CSF_LIBRARY}_library" STREQUAL "${CACHE_VARIABLE}" OR
248 "3rdparty_${CSF_WO_VERSION}_library" STREQUAL "${CACHE_VARIABLE}" OR
249 NOT "x${IS_ENDING}" STREQUAL "x" OR
250 NOT "x${IS_ENDING_WO_VERSION}" STREQUAL "x")
251 list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${CURRENT_CACHE_LIBRARY}")
252 set (LIBRARY_FROM_CACHE 1)
253 endif()
254 endif()
255 endforeach()
256 endforeach()
257
258 if (NOT ${LIBRARY_FROM_CACHE})
259 # prepare a list from a string with whitespaces
260 separate_arguments (CURRENT_CSF)
261 list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${CURRENT_CSF})
262 endif()
a6874708 263 endif()
fb3267c7 264 endif()
316d77d9 265 endif()
266 endif()
fb3267c7 267endforeach()
316d77d9 268
e713baee 269if (APPLE)
270 list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT X11 IS_X11_FOUND)
271 if (NOT ${IS_X11_FOUND} EQUAL -1)
272 find_package (X11 COMPONENTS X11 Xext Xmu Xi)
273 if (NOT X11_FOUND)
a6874708 274 message (STATUS "Warning: X11 is not found. It's required to install The XQuartz project: http://www.xquartz.org")
e713baee 275 endif()
276 endif()
277endif()
278
88d533be 279# Update list of used VTK libraries if OpenGL2 Rendering BackEnd is used.
280# Add VTK_OPENGL2_BACKEND definition.
281if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2")
282 add_definitions(-DVTK_OPENGL2_BACKEND)
283 foreach (VTK_EXCLUDE_LIBRARY vtkRenderingOpenGL vtkRenderingFreeTypeOpenGL)
5891b8ba 284 list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "${VTK_EXCLUDE_LIBRARY}" IS_VTK_OPENGL_FOUND)
88d533be 285 if (NOT ${IS_VTK_OPENGL_FOUND} EQUAL -1)
5891b8ba 286 list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT ${VTK_EXCLUDE_LIBRARY})
88d533be 287 if (${VTK_EXCLUDE_LIBRARY} STREQUAL vtkRenderingOpenGL)
5891b8ba 288 list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingOpenGL2)
4f26118e 289 if(VTK_MAJOR_VERSION GREATER 6)
5891b8ba 290 list (APPEND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT vtkRenderingGL2PSOpenGL2)
4f26118e 291 endif()
88d533be 292 endif()
293 endif()
294 endforeach()
4f26118e 295else()
296 if(VTK_MAJOR_VERSION EQUAL 6 AND VTK_MINOR_VERSION GREATER 2 OR VTK_MAJOR_VERSION GREATER 6)
5891b8ba 297 list (FIND USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL" IS_VTK_RENDER_FREETYPE_FOUND)
4f26118e 298 if (NOT ${IS_VTK_RENDER_FREETYPE_FOUND} EQUAL -1)
5891b8ba 299 list (REMOVE_ITEM USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT "vtkRenderingFreeTypeOpenGL")
4f26118e 300 endif()
301 endif()
88d533be 302endif()
303
3321f684 304if (BUILD_SHARED_LIBS)
5891b8ba 305 target_link_libraries (${PROJECT_NAME} PUBLIC ${USED_TOOLKITS_BY_CURRENT_PROJECT})
306 target_link_libraries (${PROJECT_NAME} PRIVATE ${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT})
3321f684 307endif()
896faa72 308
a131689d 309# suppress deprecation warnings inside OCCT itself for old gcc versions with unavailable Standard_DISABLE_DEPRECATION_WARNINGS
310if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
311 if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6.0)
312 add_definitions("-DOCCT_NO_DEPRECATED")
313 message (STATUS "Warning: internal deprecation warnings by Standard_DEPRECATED have been disabled due to old gcc version being used")
314 endif()
315endif()
316
896faa72 317# use Cotire to accelerate build via usage of precompiled headers
318if (BUILD_USE_PCH)
319 if (WIN32)
320 # prevent definition of min and max macros through inclusion of Windows.h
321 # (for cotire builds)
322 add_definitions("-DNOMINMAX")
323 # avoid warnings on deprecated names from standard C library (see strsafe.h)
324 add_definitions("-DSTRSAFE_NO_DEPRECATE")
325 # avoid "std::Equal1" warning in QANCollection_Stl.cxx in debug mode
326 # suggesting using msvc "Checked Iterators"
327 add_definitions("-D_SCL_SECURE_NO_WARNINGS")
328 endif()
329
330 # Exclude system-provided glext.h.
331 # These macros are already defined within OpenGl_GlFunctions.hxx,
332 # however we have to duplicate them here for building TKOpenGl with PCH.
333 add_definitions("-DGL_GLEXT_LEGACY")
334 add_definitions("-DGLX_GLXEXT_LEGACY")
335
336 # workaround for old gcc
337 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
08f8a185 338 add_definitions("-D__STDC_CONSTANT_MACROS")
896faa72 339 add_definitions("-D__STDC_FORMAT_MACROS")
340 endif()
341
342 # unity builds are not used since they do not add speed but cause conflicts
343 # in TKV3d
344 set_target_properties(${PROJECT_NAME} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
345
346 cotire(${PROJECT_NAME})
347endif()