0030715: Configuration, CMake - error build with QTANGLE
[occt.git] / adm / cmake / 3rdparty_macro.cmake
CommitLineData
e713baee 1##
2
3if(3RDPARTY_MACRO_ALREADY_INCLUDED)
4 return()
5endif()
6set(3RDPARTY_MACRO_ALREADY_INCLUDED 1)
9f33b387 7
9f33b387 8
4fecc365 9macro (THIRDPARTY_PRODUCT PRODUCT_NAME HEADER_NAME LIBRARY_CSF_NAME LIBRARY_NAME_DEBUG_SUFFIX)
9f33b387 10
3321f684 11 if (NOT DEFINED INSTALL_${PRODUCT_NAME} AND BUILD_SHARED_LIBS)
e713baee 12 set (INSTALL_${PRODUCT_NAME} OFF CACHE BOOL "${INSTALL_${PRODUCT_NAME}_DESCR}")
13 endif()
14
9f33b387 15 if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DIR)
16 set (3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME}")
17 endif()
18
e713baee 19 # include occt macros. compiler_bitness, os_wiht_bit, compiler
20 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
21
22 # specify product folder in connectin with 3RDPARTY_DIR
23 if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
24 #CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_${PRODUCT_NAME}_DIR PATH "The directory containing ${PRODUCT_NAME}")
25
26 if (NOT 3RDPARTY_${PRODUCT_NAME}_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
27 FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" ${PRODUCT_NAME} ${PRODUCT_NAME}_DIR_NAME)
28 if (${PRODUCT_NAME}_DIR_NAME)
29 set (3RDPARTY_${PRODUCT_NAME}_DIR "${3RDPARTY_DIR}/${${PRODUCT_NAME}_DIR_NAME}" CACHE PATH "The directory containing ${PRODUCT_NAME}" FORCE)
30 endif()
9f33b387 31 endif()
e713baee 32 else()
33 #set (3RDPARTY_${PRODUCT_NAME}_DIR "" CACHE PATH "The directory containing ${PRODUCT_NAME}" FORCE)
9f33b387 34 endif()
35
e713baee 36 if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
37 set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE PATH "the path of ${HEADER_NAME}")
9f33b387 38 endif()
39
4fecc365 40 separate_arguments (${LIBRARY_CSF_NAME})
41 foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
42 string (REPLACE "." "" LIBRARY_NAME "${LIBRARY_NAME}")
43 if (BUILD_SHARED_LIBS)
44 if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME} OR NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}")
45 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME} "" CACHE FILEPATH "${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
46 endif()
19286d7c 47
4fecc365 48 if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME})
49 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} "" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"")
50 endif()
9f33b387 51
4fecc365 52 if (WIN32)
53 if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME} OR NOT 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}")
54 set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME} "" CACHE FILEPATH "${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
55 endif()
3321f684 56 endif()
9f33b387 57
4fecc365 58 if (WIN32)
59 if (NOT DEFINED 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME})
60 set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"")
61 endif()
3321f684 62 endif()
e713baee 63 endif()
19286d7c 64
4fecc365 65 # check 3RDPARTY_${PRODUCT_NAME}_ paths for consistency with specified 3RDPARTY_${PRODUCT_NAME}_DIR
66 if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
67 CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR PATH "the path to ${PRODUCT_NAME}")
68 if (BUILD_SHARED_LIBS)
69 CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME} FILEPATH "the path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"")
19286d7c 70
4fecc365 71 if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME}}")
72 get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME}}" PATH)
73 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
74 else()
75 CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"")
76 endif()
19286d7c 77
4fecc365 78 if (WIN32)
79 CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME} FILEPATH "the path to ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"")
19286d7c 80
4fecc365 81 if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME}}")
82 get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME}}" PATH)
83 set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
84 else()
85 CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_${PRODUCT_NAME}_DIR 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"")
86 endif()
3321f684 87 endif()
9f33b387 88 endif()
89 endif()
4fecc365 90 endforeach()
e713baee 91 # header
92 if (NOT 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
19286d7c 93
e713baee 94 # set 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR
95 set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR-NOTFOUND" CACHE FILEPATH "the path to ${HEADER_NAME}" FORCE)
19286d7c 96
e713baee 97 if (3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}")
98 find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR NAMES ${HEADER_NAME}
99 PATHS ${3RDPARTY_${PRODUCT_NAME}_DIR}
26e0b335 100 PATH_SUFFIXES include inc
e713baee 101 CMAKE_FIND_ROOT_PATH_BOTH
102 NO_DEFAULT_PATH)
103 else()
104 find_path (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR NAMES ${HEADER_NAME}
26e0b335 105 PATH_SUFFIXES include inc
e713baee 106 CMAKE_FIND_ROOT_PATH_BOTH)
9f33b387 107 endif()
108 endif()
19286d7c 109
9f33b387 110 if (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
111 list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR}")
112 else()
113 list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR)
e713baee 114
115 set (3RDPARTY_${PRODUCT_NAME}_INCLUDE_DIR "" CACHE FILEPATH "The path to ${HEADER_NAME}" FORCE)
116 endif()
117
4fecc365 118 foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
119 string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
0553a8ea 120# if (BUILD_SHARED_LIBS)
4fecc365 121 # library
122 if (NOT 3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}")
123 set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
19286d7c 124
4fecc365 125 set (${PRODUCT_NAME}_PATH_SUFFIXES lib)
26e0b335 126 if (WIN32)
127 set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} win${COMPILER_BITNESS}/${COMPILER}/lib)
128 endif()
4fecc365 129 if (ANDROID)
130 set (${PRODUCT_NAME}_PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES} libs/${ANDROID_ABI})
131 endif()
9f33b387 132
4fecc365 133 # set 3RDPARTY_${PRODUCT_NAME}_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_LIBRARY
134 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
096ef695 135
5771d380 136 if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}"))
4fecc365 137 find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
138 PATHS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
139 PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
140 CMAKE_FIND_ROOT_PATH_BOTH
141 NO_DEFAULT_PATH)
14bbbdcb 142 if ("${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}" STREQUAL "3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}-NOTFOUND")
143 # find directory recursive
144 FIND_SUBDIRECTORY (${3RDPARTY_${PRODUCT_NAME}_DIR} "${${PRODUCT_NAME}_PATH_SUFFIXES}" SUBDIR_NAME)
145 if (NOT "${SUBDIR_NAME}" STREQUAL "")
146 find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME_SUFFIX}
147 PATHS "${SUBDIR_NAME}"
148 PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
149 CMAKE_FIND_ROOT_PATH_BOTH
150 NO_DEFAULT_PATH)
151 endif()
152 endif()
3321f684 153 else()
4fecc365 154 find_library (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
155 PATH_SUFFIXES ${${PRODUCT_NAME}_PATH_SUFFIXES}
156 CMAKE_FIND_ROOT_PATH_BOTH)
3321f684 157 endif()
096ef695 158
4fecc365 159 if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}")
160 get_filename_component (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}}" PATH)
161 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
096ef695 162 else()
4fecc365 163 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} "" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
096ef695 164 endif()
19286d7c 165 endif()
096ef695 166
4fecc365 167 if (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
168 list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
3321f684 169 else()
0553a8ea 170 list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX})
4fecc365 171
172 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} "" CACHE FILEPATH "The path to ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
3321f684 173 endif()
3321f684 174
4fecc365 175 # shared library
176 if (WIN32)
177 if (NOT 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} OR NOT EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}")
3321f684 178
4fecc365 179 set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
096ef695 180
4fecc365 181 # set 3RDPARTY_${PRODUCT_NAME}_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_${PRODUCT_NAME}_DLL
182 set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND" CACHE FILEPATH "The path to ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
3321f684 183
5771d380 184 if ((3RDPARTY_${PRODUCT_NAME}_DIR AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DIR}") OR (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}"))
4fecc365 185 find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME}
5771d380 186 PATHS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME}}" "${3RDPARTY_${PRODUCT_NAME}_DIR}"
26e0b335 187 PATH_SUFFIXES bin win${COMPILER_BITNESS}/${COMPILER}/bin
4fecc365 188 NO_DEFAULT_PATH)
14bbbdcb 189 if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} STREQUAL "3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}-NOTFOUND")
190 # find directory recursive
191 FIND_SUBDIRECTORY (${3RDPARTY_${PRODUCT_NAME}_DIR} bin SUBDIR_NAME)
192 if (NOT "${SUBDIR_NAME}" STREQUAL "")
193 find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME_SUFFIX}
194 PATHS "${SUBDIR_NAME}"
195 PATH_SUFFIXES bin
196 NO_DEFAULT_PATH)
197 endif()
198 endif()
4fecc365 199 else()
200 find_library (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} NAMES ${LIBRARY_NAME} PATH_SUFFIXES bin)
201 endif()
3321f684 202
4fecc365 203 if (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} AND EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}")
204 get_filename_component (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}" PATH)
205 set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}" CACHE PATH "The directory containing ${PRODUCT_NAME} library \"${LIBRARY_NAME}\"" FORCE)
3321f684 206 else()
4fecc365 207 set (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} "" CACHE PATH "The directory containing ${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
208
209 set (3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX} "" CACHE FILEPATH "${PRODUCT_NAME} shared library \"${LIBRARY_NAME}\"" FORCE)
3321f684 210 endif()
211 endif()
212
4fecc365 213 if (3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX} OR EXISTS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}")
214 list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}}")
215 else()
0553a8ea 216 list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX})
4fecc365 217 endif()
218 endif()
219
d51a0ff6 220 if (WIN32)
221 set (3RDPARTY_${PRODUCT_NAME}_DLL_DIRS "")
222 else()
223 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIRS "")
224 endif()
225
226 foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
227 string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
228 if (WIN32)
229 set (3RDPARTY_${PRODUCT_NAME}_DLL_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}};${3RDPARTY_${PRODUCT_NAME}_DLL_DIRS}")
14bbbdcb 230 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}")
d51a0ff6 231 else()
232 set (3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}:${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIRS}")
233 endif()
234 endforeach()
235
236 set (USED_3RDPARTY_${PRODUCT_NAME}_DIRS "")
3321f684 237
4fecc365 238 if (INSTALL_${PRODUCT_NAME})
239 OCCT_MAKE_OS_WITH_BITNESS()
240 OCCT_MAKE_COMPILER_SHORT_NAME()
241
242 if (WIN32)
3321f684 243 if (SINGLE_GENERATOR)
4fecc365 244 install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}" DESTINATION "${INSTALL_DIR_BIN}")
3321f684 245 else()
4fecc365 246 install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}"
3321f684 247 CONFIGURATIONS Release
4fecc365 248 DESTINATION "${INSTALL_DIR_BIN}")
249 install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}"
3321f684 250 CONFIGURATIONS RelWithDebInfo
4fecc365 251 DESTINATION "${INSTALL_DIR_BIN}i")
252 install (FILES "${3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX}}"
3321f684 253 CONFIGURATIONS Debug
4fecc365 254 DESTINATION "${INSTALL_DIR_BIN}d")
255 endif()
256 else()
257 get_filename_component(ABS_PATH ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} REALPATH)
258
259 if ("${PRODUCT_NAME}" STREQUAL "FREEIMAGE")
260 get_filename_component(FREEIMLIB ${3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX}} NAME)
261
262 if (SINGLE_GENERATOR)
263 install (FILES "${ABS_PATH}" DESTINATION "${INSTALL_DIR_LIB}" RENAME ${FREEIMLIB}.3)
264 else()
265 install (FILES "${ABS_PATH}"
266 CONFIGURATIONS Release
267 DESTINATION "${INSTALL_DIR_LIB}"
268 RENAME ${FREEIMLIB}.3)
269 install (FILES "${ABS_PATH}"
270 CONFIGURATIONS RelWithDebInfo
271 DESTINATION "${INSTALL_DIR_LIB}i"
272 RENAME ${FREEIMLIB}.3)
273 install (FILES "${ABS_PATH}"
274 CONFIGURATIONS Debug
275 DESTINATION "${INSTALL_DIR_LIB}d"
276 RENAME ${FREEIMLIB}.3)
277 endif()
278 endif()
279
096ef695 280 endif()
3321f684 281 else()
4fecc365 282 # the library directory for using by the executable
d51a0ff6 283 foreach (LIBRARY_NAME ${${LIBRARY_CSF_NAME}})
284 string (REPLACE "." "" LIBRARY_NAME_SUFFIX "${LIBRARY_NAME}")
285 if (WIN32)
286 set (USED_3RDPARTY_${PRODUCT_NAME}_DIRS "${3RDPARTY_${PRODUCT_NAME}_DLL_DIR_${LIBRARY_NAME_SUFFIX}};${USED_3RDPARTY_${PRODUCT_NAME}_DIRS}")
287 else()
288 set (USED_3RDPARTY_${PRODUCT_NAME}_DIRS "${3RDPARTY_${PRODUCT_NAME}_LIBRARY_DIR_${LIBRARY_NAME_SUFFIX}}:${USED_3RDPARTY_${PRODUCT_NAME}_DIRS}")
289 endif()
290 endforeach()
3321f684 291 endif()
19286d7c 292
4fecc365 293 mark_as_advanced (3RDPARTY_${PRODUCT_NAME}_LIBRARY_${LIBRARY_NAME_SUFFIX} 3RDPARTY_${PRODUCT_NAME}_DLL_${LIBRARY_NAME_SUFFIX})
0553a8ea 294# endif()
4fecc365 295 endforeach()
19286d7c 296endmacro()
82f443b6 297
298macro (COMPLIANCE_PRODUCT_CONSISTENCY LIBNAME)
299 if (3RDPARTY_${LIBNAME}_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DIR}")
300 # include dir
301 set (DOES_PATH_CONTAIN FALSE)
302 if (3RDPARTY_${LIBNAME}_INCLUDE_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
303 string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_INCLUDE_DIR}")
304 endif()
305 if (NOT DOES_PATH_CONTAIN)
306 set (3RDPARTY_${LIBNAME}_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of ${LIBNAME}" FORCE)
307 endif()
308
3321f684 309 if (BUILD_SHARED_LIBS)
310 # library dir
82f443b6 311 set (DOES_PATH_CONTAIN FALSE)
3321f684 312 if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
313 string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
82f443b6 314 endif()
315 if (NOT DOES_PATH_CONTAIN)
3321f684 316 set (3RDPARTY_${LIBNAME}_LIBRARY_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} library" FORCE)
82f443b6 317 endif()
82f443b6 318
3321f684 319 # shared library dir
320 if (WIN32)
321 set (DOES_PATH_CONTAIN FALSE)
322 if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
323 string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL_DIR}")
324 endif()
325 if (NOT DOES_PATH_CONTAIN)
326 set (3RDPARTY_${LIBNAME}_DLL_DIR "" CACHE FILEPATH "The directory containing ${LIBNAME} shared library" FORCE)
327 endif()
328 endif()
82f443b6 329 endif()
330 endif()
82f443b6 331
3321f684 332 if (BUILD_SHARED_LIBS)
333 # check library
82f443b6 334 set (DOES_PATH_CONTAIN FALSE)
3321f684 335 if (3RDPARTY_${LIBNAME}_LIBRARY_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}")
336 if (3RDPARTY_${LIBNAME}_LIBRARY AND EXISTS "${3RDPARTY_${LIBNAME}_LIBRARY}")
337 string (REGEX MATCH "${3RDPARTY_${LIBNAME}_LIBRARY_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_LIBRARY}")
82f443b6 338 endif()
339 endif()
340 if (NOT DOES_PATH_CONTAIN)
3321f684 341 set (3RDPARTY_${LIBNAME}_LIBRARY "" CACHE FILEPATH "${LIBNAME} library" FORCE)
342 endif()
343
344 # check shared library
345 if (WIN32)
346 set (DOES_PATH_CONTAIN FALSE)
347 if (3RDPARTY_${LIBNAME}_DLL_DIR AND EXISTS "${3RDPARTY_${LIBNAME}_DLL_DIR}")
348 if (3RDPARTY_${LIBNAME}_DLL AND EXISTS "${3RDPARTY_${LIBNAME}_DLL}")
349 string (REGEX MATCH "${3RDPARTY_${LIBNAME}_DLL_DIR}" DOES_PATH_CONTAIN "${3RDPARTY_${LIBNAME}_DLL}")
350 endif()
351 endif()
352 if (NOT DOES_PATH_CONTAIN)
353 set (3RDPARTY_${LIBNAME}_DLL "" CACHE FILEPATH "${LIBNAME} shared library" FORCE)
354 endif()
82f443b6 355 endif()
356 endif()
357endmacro()