0026880: Configuration, CMake - platform dependent code is not generated
[occt.git] / adm / cmake / occt_macros.cmake
CommitLineData
19286d7c 1#
2macro (OCCT_CHECK_AND_UNSET VARNAME)
3 if (DEFINED ${VARNAME})
4 unset (${VARNAME} CACHE)
5 endif()
6endmacro()
7
8macro (OCCT_CHECK_AND_UNSET_GROUP VARNAME)
9 OCCT_CHECK_AND_UNSET ("${VARNAME}_DIR")
10
11 OCCT_CHECK_AND_UNSET ("${VARNAME}_INCLUDE_DIR")
12
13 OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY")
14 OCCT_CHECK_AND_UNSET ("${VARNAME}_LIBRARY_DIR")
15
16 if (WIN32)
17 OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL")
18 OCCT_CHECK_AND_UNSET ("${VARNAME}_DLL_DIR")
19 endif()
20endmacro()
21
19286d7c 22# COMPILER_BITNESS variable
23macro (OCCT_MAKE_COMPILER_BITNESS)
24 math (EXPR COMPILER_BITNESS "32 + 32*(${CMAKE_SIZEOF_VOID_P}/8)")
25endmacro()
26
27# OS_WITH_BIT
28macro (OCCT_MAKE_OS_WITH_BITNESS)
29
30 OCCT_MAKE_COMPILER_BITNESS()
31
32 if (WIN32)
33 set (OS_WITH_BIT "win${COMPILER_BITNESS}")
34 elseif(APPLE)
35 set (OS_WITH_BIT "mac${COMPILER_BITNESS}")
36 else()
37 set (OS_WITH_BIT "lin${COMPILER_BITNESS}")
38 endif()
39endmacro()
40
41# COMPILER variable
42macro (OCCT_MAKE_COMPILER_SHORT_NAME)
43 if (MSVC)
44 if (MSVC70)
45 set (COMPILER vc7)
46 elseif (MSVC80)
47 set (COMPILER vc8)
48 elseif (MSVC90)
49 set (COMPILER vc9)
50 elseif (MSVC10)
51 set (COMPILER vc10)
52 elseif (MSVC11)
53 set (COMPILER vc11)
54 elseif (MSVC12)
55 set (COMPILER vc12)
63cf1bb6 56 elseif (MSVC14)
57 set (COMPILER vc14)
19286d7c 58 endif()
59 elseif (DEFINED CMAKE_COMPILER_IS_GNUCC)
60 set (COMPILER gcc)
61 elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
62 set (COMPILER gxx)
63 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
64 set (COMPILER clang)
65 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
66 set (COMPILER icc)
67 else()
68 set (COMPILER ${CMAKE_GENERATOR})
69 string (REGEX REPLACE " " "" COMPILER ${COMPILER})
70 endif()
71endmacro()
72
73function (SUBDIRECTORY_NAMES MAIN_DIRECTORY RESULT)
74 file (GLOB SUB_ITEMS "${MAIN_DIRECTORY}/*")
75
76 foreach (ITEM ${SUB_ITEMS})
77 if (IS_DIRECTORY "${ITEM}")
78 get_filename_component (ITEM_NAME "${ITEM}" NAME)
79 list (APPEND LOCAL_RESULT "${ITEM_NAME}")
80 endif()
81 endforeach()
82 set (${RESULT} ${LOCAL_RESULT} PARENT_SCOPE)
83endfunction()
84
f2e9c853 85function (OCCT_ORIGIN_AND_PATCHED_FILES RELATIVE_PATH SEARCH_TEMPLATE RESULT)
86
87 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}")
88 file (GLOB FOUND_FILES "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}/${SEARCH_TEMPLATE}")
89 endif()
90
91 file (GLOB ORIGIN_FILES "${CMAKE_SOURCE_DIR}/${RELATIVE_PATH}/${SEARCH_TEMPLATE}")
92 foreach (ORIGIN_FILE ${ORIGIN_FILES})
93 # check for existence of patched version of current file
94 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}")
95 get_filename_component (ORIGIN_FILE_NAME "${ORIGIN_FILE}" NAME)
96 if (EXISTS "${APPLY_OCCT_PATCH_DIR}/${RELATIVE_PATH}/${ORIGIN_FILE_NAME}")
97 continue()
98 endif()
99 endif()
100
101 # append origin version if patched one is not found
102 list (APPEND FOUND_FILES ${ORIGIN_FILE})
103 endforeach()
104
105 set (${RESULT} ${FOUND_FILES} PARENT_SCOPE)
106endfunction()
107
19286d7c 108function (FIND_PRODUCT_DIR ROOT_DIR PRODUCT_NAME RESULT)
109 OCCT_MAKE_COMPILER_SHORT_NAME()
110 OCCT_MAKE_COMPILER_BITNESS()
111
112 string (TOLOWER "${PRODUCT_NAME}" lower_PRODUCT_NAME)
113
d3ff0ff2 114 list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*${COMPILER}.*${COMPILER_BITNESS}")
115 list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER}.*${COMPILER_BITNESS}")
116 list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+.*${COMPILER_BITNESS}")
117 list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*[0-9.]+")
118 list (APPEND SEARCH_TEMPLATES "^[^a-zA-Z]*${lower_PRODUCT_NAME}[^a-zA-Z]*")
19286d7c 119
120 SUBDIRECTORY_NAMES ("${ROOT_DIR}" SUBDIR_NAME_LIST)
121
122 foreach (SEARCH_TEMPLATE ${SEARCH_TEMPLATES})
123 if (LOCAL_RESULT)
124 BREAK()
125 endif()
126
127 foreach (SUBDIR_NAME ${SUBDIR_NAME_LIST})
128 string (TOLOWER "${SUBDIR_NAME}" lower_SUBDIR_NAME)
129
130 string (REGEX MATCH "${SEARCH_TEMPLATE}" DUMMY_VAR "${lower_SUBDIR_NAME}")
131 if (DUMMY_VAR)
132 list (APPEND LOCAL_RESULT ${SUBDIR_NAME})
133 endif()
134 endforeach()
135 endforeach()
136
137 if (LOCAL_RESULT)
138 list (LENGTH "${LOCAL_RESULT}" LOC_LEN)
139 math (EXPR LAST_ELEMENT_INDEX "${LOC_LEN}-1")
140 list (GET LOCAL_RESULT ${LAST_ELEMENT_INDEX} DUMMY)
141 set (${RESULT} ${DUMMY} PARENT_SCOPE)
142 endif()
143endfunction()
144
145macro (OCCT_INSTALL_FILE_OR_DIR BEING_INSTALLED_OBJECT DESTINATION_PATH)
316d77d9 146 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_INSTALLED_OBJECT}")
147 if (IS_DIRECTORY "${APPLY_OCCT_PATCH_DIR}/${BEING_INSTALLED_OBJECT}")
19286d7c 148 # first of all, install original files
149 install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
150
151 # secondly, rewrite original files with patched ones
316d77d9 152 install (DIRECTORY "${APPLY_OCCT_PATCH_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
19286d7c 153 else()
316d77d9 154 install (FILES "${APPLY_OCCT_PATCH_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
19286d7c 155 endif()
156 else()
157 if (IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}")
158 install (DIRECTORY "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
159 else()
160 install (FILES "${CMAKE_SOURCE_DIR}/${BEING_INSTALLED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
161 endif()
162 endif()
163endmacro()
164
316d77d9 165macro (OCCT_CONFIGURE_AND_INSTALL BEING_CONGIRUGED_FILE BUILD_NAME INSTALL_NAME DESTINATION_PATH)
166 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_CONGIRUGED_FILE}")
167 configure_file("${APPLY_OCCT_PATCH_DIR}/${BEING_CONGIRUGED_FILE}" "${BUILD_NAME}" @ONLY)
19286d7c 168 else()
316d77d9 169 configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${BUILD_NAME}" @ONLY)
19286d7c 170 endif()
171
316d77d9 172 install(FILES "${OCCT_BINARY_DIR}/${BUILD_NAME}" DESTINATION "${DESTINATION_PATH}" RENAME ${INSTALL_NAME})
19286d7c 173endmacro()
174
f2e9c853 175macro (COLLECT_AND_INSTALL_OCCT_HEADER_FILES ROOT_TARGET_OCCT_DIR OCCT_BUILD_TOOLKITS)
94829f84 176 set (OCCT_SOURCE_DIRS)
177
f2e9c853 178 # consider patched header.in template
179 set (TEMPLATE_HEADER_PATH "${CMAKE_SOURCE_DIR}/adm/templates/header.in")
180 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/adm/templates/header.in")
181 set (TEMPLATE_HEADER_PATH "${APPLY_OCCT_PATCH_DIR}/adm/templates/header.in")
182 endif()
183
184 set (ROOT_OCCT_DIR ${CMAKE_SOURCE_DIR})
185
316d77d9 186 foreach (OCCT_USED_TOOLKIT ${OCCT_BUILD_TOOLKITS})
94829f84 187 # append parent folder
188 list (APPEND OCCT_SOURCE_DIRS ${OCCT_USED_TOOLKIT})
189
190 # append all required package folders
191 set (OCCT_USED_TOOLKIT_DEPS)
f2e9c853 192 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES")
193 file (STRINGS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES" OCCT_USED_TOOLKIT_DEPS)
194 elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES")
195 file (STRINGS "${CMAKE_SOURCE_DIR}/src/${OCCT_USED_TOOLKIT}/PACKAGES" OCCT_USED_TOOLKIT_DEPS)
94829f84 196 endif()
197
198 foreach (OCCT_USED_TOOLKIT_DEP ${OCCT_USED_TOOLKIT_DEPS})
199 list (APPEND OCCT_SOURCE_DIRS ${OCCT_USED_TOOLKIT_DEP})
200 endforeach()
201 endforeach()
202
203 foreach (OCCT_SOURCE_DIR ${OCCT_SOURCE_DIRS})
f2e9c853 204 # get all header files from each src folder
205 file (GLOB OCCT_HEADER_FILES "${CMAKE_SOURCE_DIR}/src/${OCCT_SOURCE_DIR}/*.[hgl]xx" "${CMAKE_SOURCE_DIR}/src/${OCCT_SOURCE_DIR}/*.h")
94829f84 206 install (FILES ${OCCT_HEADER_FILES} DESTINATION "${INSTALL_DIR}/inc")
207
208 # create new file including found header
209 foreach (OCCT_HEADER_FILE ${OCCT_HEADER_FILES})
210 get_filename_component (HEADER_FILE_NAME ${OCCT_HEADER_FILE} NAME)
211 configure_file ("${TEMPLATE_HEADER_PATH}" "${ROOT_TARGET_OCCT_DIR}/inc/${HEADER_FILE_NAME}" @ONLY)
212 endforeach()
f2e9c853 213
214 # consider pathed the source files
215 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_SOURCE_DIR}")
216 file (GLOB PATCHED_OCCT_HEADER_FILES "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_SOURCE_DIR}/*.[hgl]xx" "${APPLY_OCCT_PATCH_DIR}/src/${OCCT_SOURCE_DIR}/*.h")
217 install (FILES ${PATCHED_OCCT_HEADER_FILES} DESTINATION "${INSTALL_DIR}/inc")
218
219 # create new patched file including found header
220 foreach (OCCT_HEADER_FILE ${PATCHED_OCCT_HEADER_FILES})
221 get_filename_component (HEADER_FILE_NAME ${OCCT_HEADER_FILE} NAME)
222 configure_file ("${TEMPLATE_HEADER_PATH}" "${ROOT_TARGET_OCCT_DIR}/inc/${HEADER_FILE_NAME}" @ONLY)
223 endforeach()
224 endif()
94829f84 225 endforeach()
226endmacro()
227
19286d7c 228macro (OCCT_COPY_FILE_OR_DIR BEING_COPIED_OBJECT DESTINATION_PATH)
229 # first of all, copy original files
f2e9c853 230 if (EXISTS "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}")
231 file (COPY "${CMAKE_SOURCE_DIR}/${BEING_COPIED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
232 endif()
19286d7c 233
316d77d9 234 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_COPIED_OBJECT}")
19286d7c 235 # secondly, rewrite original files with patched ones
316d77d9 236 file (COPY "${APPLY_OCCT_PATCH_DIR}/${BEING_COPIED_OBJECT}" DESTINATION "${DESTINATION_PATH}")
19286d7c 237 endif()
238endmacro()
239
240macro (OCCT_CONFIGURE BEING_CONGIRUGED_FILE FINAL_NAME)
316d77d9 241 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_CONGIRUGED_FILE}")
242 configure_file("${APPLY_OCCT_PATCH_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
19286d7c 243 else()
244 configure_file("${CMAKE_SOURCE_DIR}/${BEING_CONGIRUGED_FILE}" "${FINAL_NAME}" @ONLY)
245 endif()
246endmacro()
247
f2e9c853 248macro (OCCT_ADD_SUBDIRECTORY BEING_ADDED_DIRECTORY)
249 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${BEING_ADDED_DIRECTORY}/CMakeLists.txt")
250 add_subdirectory(${APPLY_OCCT_PATCH_DIR}/${BEING_ADDED_DIRECTORY})
251 elseif (EXISTS "${CMAKE_SOURCE_DIR}/${BEING_ADDED_DIRECTORY}/CMakeLists.txt")
252 add_subdirectory (${CMAKE_SOURCE_DIR}/${BEING_ADDED_DIRECTORY})
253 else()
254 message (STATUS "${BEING_ADDED_DIRECTORY} directory is not included")
255 endif()
256endmacro()
257
19286d7c 258function (OCCT_IS_PRODUCT_REQUIRED CSF_VAR_NAME USE_PRODUCT)
259 set (${USE_PRODUCT} OFF PARENT_SCOPE)
260
316d77d9 261 if (NOT BUILD_TOOLKITS)
19286d7c 262 message(STATUS "Warning: the list of being used toolkits is empty")
263 else()
316d77d9 264 foreach (USED_TOOLKIT ${BUILD_TOOLKITS})
265 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/src/${USED_TOOLKIT}/EXTERNLIB")
266 file (READ "${APPLY_OCCT_PATCH_DIR}/src/${USED_TOOLKIT}/EXTERNLIB" FILE_CONTENT)
19286d7c 267 elseif (EXISTS "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}/EXTERNLIB")
268 file (READ "${CMAKE_SOURCE_DIR}/src/${USED_TOOLKIT}/EXTERNLIB" FILE_CONTENT)
269 endif()
270
271 string (REGEX MATCH "${CSF_VAR_NAME}" DOES_FILE_CONTAIN "${FILE_CONTENT}")
272
273 if (DOES_FILE_CONTAIN)
274 set (${USE_PRODUCT} ON PARENT_SCOPE)
275 break()
276 endif()
277 endforeach()
278 endif()
279endfunction()
280
281function (FILE_TO_LIST FILE_NAME FILE_CONTENT)
282 set (LOCAL_FILE_CONTENT)
316d77d9 283 if (APPLY_OCCT_PATCH_DIR AND EXISTS "${APPLY_OCCT_PATCH_DIR}/${FILE_NAME}")
284 file (STRINGS "${APPLY_OCCT_PATCH_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
19286d7c 285 elseif (EXISTS "${CMAKE_SOURCE_DIR}/${FILE_NAME}")
286 file (STRINGS "${CMAKE_SOURCE_DIR}/${FILE_NAME}" LOCAL_FILE_CONTENT)
287 endif()
288
289 set (${FILE_CONTENT} ${LOCAL_FILE_CONTENT} PARENT_SCOPE)
290endfunction()
291
292# Function to determine if TOOLKIT is OCCT toolkit
293function (IS_OCCT_TOOLKIT TOOLKIT_NAME MODULES IS_TOOLKIT_FOUND)
294 set (${IS_TOOLKIT_FOUND} OFF PARENT_SCOPE)
295 foreach (MODULE ${${MODULES}})
296 set (TOOLKITS ${${MODULE}_TOOLKITS})
297 list (FIND TOOLKITS ${TOOLKIT_NAME} FOUND)
298
299 if (NOT ${FOUND} EQUAL -1)
300 set (${IS_TOOLKIT_FOUND} ON PARENT_SCOPE)
301 endif()
302 endforeach(MODULE)
303endfunction()
304
305# TOOLKIT_DEPS is defined with dependencies from file src/TOOLKIT_NAME/EXTERNLIB.
306# CSF_ variables are ignored
307function (OCCT_TOOLKIT_DEP TOOLKIT_NAME TOOLKIT_DEPS)
308 FILE_TO_LIST ("src/${TOOLKIT_NAME}/EXTERNLIB" FILE_CONTENT)
309
310 #list (APPEND LOCAL_TOOLKIT_DEPS ${TOOLKIT_NAME})
311 set (LOCAL_TOOLKIT_DEPS)
312 foreach (FILE_CONTENT_LINE ${FILE_CONTENT})
313 string (REGEX MATCH "^TK" TK_FOUND ${FILE_CONTENT_LINE})
314 if ("${FILE_CONTENT_LINE}" STREQUAL "DRAWEXE" OR NOT "${TK_FOUND}" STREQUAL "")
315 list (APPEND LOCAL_TOOLKIT_DEPS ${FILE_CONTENT_LINE})
316 endif()
317 endforeach()
318
319 set (${TOOLKIT_DEPS} ${LOCAL_TOOLKIT_DEPS} PARENT_SCOPE)
320endfunction()
321
322# TOOLKIT_FULL_DEPS is defined with complete dependencies (all levels)
323function (OCCT_TOOLKIT_FULL_DEP TOOLKIT_NAME TOOLKIT_FULL_DEPS)
324 # first level dependencies are stored in LOCAL_TOOLKIT_FULL_DEPS
325 OCCT_TOOLKIT_DEP (${TOOLKIT_NAME} LOCAL_TOOLKIT_FULL_DEPS)
326
327 list (LENGTH LOCAL_TOOLKIT_FULL_DEPS LIST_LENGTH)
328 set (LIST_INDEX 0)
329 while (LIST_INDEX LESS LIST_LENGTH)
330 list (GET LOCAL_TOOLKIT_FULL_DEPS ${LIST_INDEX} CURRENT_TOOLKIT)
331 OCCT_TOOLKIT_DEP (${CURRENT_TOOLKIT} CURRENT_TOOLKIT_DEPS)
332
333 # append toolkits are not contained
334 foreach (CURRENT_TOOLKIT_DEP ${CURRENT_TOOLKIT_DEPS})
335 set (CURRENT_TOOLKIT_DEP_FOUND OFF)
336 foreach (LOCAL_TOOLKIT_FULL_DEP ${LOCAL_TOOLKIT_FULL_DEPS})
337 if ("${CURRENT_TOOLKIT_DEP}" STREQUAL "${LOCAL_TOOLKIT_FULL_DEP}")
338 set (CURRENT_TOOLKIT_DEP_FOUND ON)
339 break()
340 endif()
341 endforeach()
342 if ("${CURRENT_TOOLKIT_DEP_FOUND}" STREQUAL "OFF")
343 list (APPEND LOCAL_TOOLKIT_FULL_DEPS ${CURRENT_TOOLKIT_DEP})
344 endif()
345 endforeach()
346
347 # increment the list index
348 MATH(EXPR LIST_INDEX "${LIST_INDEX}+1")
349
350 # calculate new length
351 list (LENGTH LOCAL_TOOLKIT_FULL_DEPS LIST_LENGTH)
352 endwhile()
353
354 set (${TOOLKIT_FULL_DEPS} ${LOCAL_TOOLKIT_FULL_DEPS} PARENT_SCOPE)
355endfunction()
356
357# Function to get list of modules and toolkits from file adm/MODULES.
358# Creates list <$MODULE_LIST> to store list of MODULES and
359# <NAME_OF_MODULE>_TOOLKITS foreach module to store its toolkits.
360function (OCCT_MODULES_AND_TOOLKITS MODULE_LIST)
361 FILE_TO_LIST ("adm/MODULES" FILE_CONTENT)
362
363 foreach (CONTENT_LINE ${FILE_CONTENT})
364 string (REPLACE " " ";" CONTENT_LINE ${CONTENT_LINE})
365 list (GET CONTENT_LINE 0 MODULE_NAME)
366 list (REMOVE_AT CONTENT_LINE 0)
367 list (APPEND ${MODULE_LIST} ${MODULE_NAME})
368 # (!) REMOVE THE LINE BELOW (implicit variables)
369 set (${MODULE_NAME}_TOOLKITS ${CONTENT_LINE} PARENT_SCOPE)
370 endforeach()
371
372 set (${MODULE_LIST} ${${MODULE_LIST}} PARENT_SCOPE)
373endfunction()
374
adc33035 375# Returns OCCT version string from file Standard_Version.hxx (if available)
376function (OCCT_VERSION OCCT_VERSION_VAR)
377 set (OCC_VERSION_COMPLETE "7.1.0")
378 set (OCC_VERSION_DEVELOPMENT "")
379
380 set (OCCT_VERSION_LOCALVAR "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}")
381
382 set (STANDARD_VERSION_FILE "${CMAKE_SOURCE_DIR}/src/Standard/Standard_Version.hxx")
383 if (EXISTS "${STANDARD_VERSION_FILE}")
384 foreach (SOUGHT_VERSION OCC_VERSION_COMPLETE OCC_VERSION_DEVELOPMENT)
385 file (STRINGS "${STANDARD_VERSION_FILE}" ${SOUGHT_VERSION} REGEX "^#define ${SOUGHT_VERSION} .*")
386 string (REGEX REPLACE ".*${SOUGHT_VERSION} .*\"([^ ]+)\".*" "\\1" ${SOUGHT_VERSION} "${${SOUGHT_VERSION}}" )
387 endforeach()
388
389 if (NOT "${OCC_VERSION_DEVELOPMENT}" STREQUAL "")
390 set (OCCT_VERSION_LOCALVAR "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}")
391 else()
392 set (OCCT_VERSION_LOCALVAR "${OCC_VERSION_COMPLETE}")
393 endif()
394 endif()
395
396 set (${OCCT_VERSION_VAR} "${OCCT_VERSION_LOCALVAR}" PARENT_SCOPE)
397endfunction()
398