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