fixed: compile issue
[opensg.git] / CMake / OSGBuildFunctions.cmake
blobe725d734b150076880bcc9f0e0d5660276355833
2 #############################################################################
3 # print message depending on the setting of OSG_VERBOSE_BUILD_MESSAGES
5 FUNCTION(OSG_MSG MSG)
6     IF(OSG_VERBOSE_BUILD_MESSAGES)
7         MESSAGE(STATUS "${MSG}")
8     ENDIF(OSG_VERBOSE_BUILD_MESSAGES)
9 ENDFUNCTION(OSG_MSG)
11 #############################################################################
12 # includes _OSG_FILENAME if it exists, otherwise bails with an error.
14 MACRO(OSG_CHECKED_INCLUDE _OSG_FILENAME)
15     IF(NOT EXISTS "${_OSG_FILENAME}")
16         MESSAGE(FATAL_ERROR "File \"${_OSG_FILENAME}\" not found, "
17                 "required by ${PROJECT_NAME}\n")
18     ENDIF(NOT EXISTS "${_OSG_FILENAME}")
20     INCLUDE("${_OSG_FILENAME}")
21 ENDMACRO(OSG_CHECKED_INCLUDE)
23 #############################################################################
24 # includes _OSG_FILENAME if it exists, otherwise just ignores it.
26 MACRO(OSG_OPTIONAL_INCLUDE _OSG_FILENAME)
27     IF(EXISTS "${_OSG_FILENAME}")
28         INCLUDE("${_OSG_FILENAME}")
29     ENDIF(EXISTS "${_OSG_FILENAME}")
30 ENDMACRO(OSG_OPTIONAL_INCLUDE)
32 ################################
33 # check and symlink
35 MACRO(OSG_SYMLINK_CHECKED _OSG_SRC_FILENAME _OSG_DST_FILENAME)
36   IF(NOT EXISTS "${_OSG_DST_FILENAME}")
37     EXECUTE_PROCESS(
38       COMMAND "${CMAKE_COMMAND}" -E create_symlink
39                "${_OSG_SRC_FILENAME}"
40                "${_OSG_DST_FILENAME}")
41   ENDIF(NOT EXISTS "${_OSG_DST_FILENAME}")
42 ENDMACRO(OSG_SYMLINK_CHECKED)
44 #############################################################################
45 # given a list of OpenSG libraries (BASELIST) it determines the full list of
46 # OpenSG libs they depend upon (OUTDEPLIST) and any dependencies that could
47 # not be found (OUTDEPMISSINGLIST).
48 # Useful to get all the include dirs needed by a lib during the build.
50 FUNCTION(OSG_GET_ALL_DEP_OSG_LIB BASELIST OUTDEPLIST OUTDEPMISSINGLIST)
52     SET(_DEPLIST        ${BASELIST})
53     SET(_DEPLISTNEW                )
54     SET(_DEPMISSINGLIST            )
56     # CMake has no do{ }while, duplicate the while loop body once
57     # outside the while loop:
59     FOREACH(DEP ${_DEPLIST})
60         SET(DEPFILE "${CMAKE_BINARY_DIR}/${DEP}.cmake")
62         IF(NOT EXISTS "${DEPFILE}")
63             LIST(APPEND _DEPMISSINGLIST ${DEP})
64         ENDIF(NOT EXISTS "${DEPFILE}")
66         OSG_OPTIONAL_INCLUDE("${DEPFILE}")
68         LIST(APPEND _DEPLISTNEW ${DEP})
69         LIST(APPEND _DEPLISTNEW ${${DEP}_DEP_OSG_LIB})
71         LIST(SORT              _DEPLISTNEW)
72         LIST(REMOVE_DUPLICATES _DEPLISTNEW)
73     ENDFOREACH(DEP)
75     LIST(LENGTH _DEPLIST    _DEPLISTLEN   )
76     LIST(LENGTH _DEPLISTNEW _DEPLISTNEWLEN)
78     #MESSAGE("_DEPLIST   : ${_DEPLIST}"   )
79     #MESSAGE("_DEPLISTNEW: ${_DEPLISTNEW}")
81     # keep iterating as long as new elements are added
82     WHILE(${_DEPLISTNEWLEN} GREATER ${_DEPLISTLEN})
84         SET(_DEPLIST    ${_DEPLISTNEW})
85         SET(_DEPLISTNEW               )
87         FOREACH(DEP ${_DEPLIST})
88             SET(DEPFILE "${CMAKE_BINARY_DIR}/${DEP}.cmake")
90             IF(NOT EXISTS "${DEPFILE}")
91                 LIST(APPEND _DEPMISSINGLIST ${DEP})
92             ENDIF(NOT EXISTS "${DEPFILE}")
94             OSG_OPTIONAL_INCLUDE("${DEPFILE}")
96             LIST(APPEND _DEPLISTNEW ${DEP}               )
97             LIST(APPEND _DEPLISTNEW ${${DEP}_DEP_OSG_LIB})
99             LIST(SORT              _DEPLISTNEW)
100             LIST(REMOVE_DUPLICATES _DEPLISTNEW)
101         ENDFOREACH(DEP)
103         #MESSAGE("_DEPLIST   : ${_DEPLIST}"   )
104         #MESSAGE("_DEPLISTNEW: ${_DEPLISTNEW}")
106         LIST(LENGTH _DEPLIST    _DEPLISTLEN   )
107         LIST(LENGTH _DEPLISTNEW _DEPLISTNEWLEN)
108     ENDWHILE(${_DEPLISTNEWLEN} GREATER ${_DEPLISTLEN})
110     IF(_DEPMISSINGLIST)
111         LIST(REMOVE_DUPLICATES _DEPMISSINGLIST)
112     ENDIF(_DEPMISSINGLIST)
114     SET(${OUTDEPLIST}        "${_DEPLISTNEW}"     PARENT_SCOPE)
115     SET(${OUTDEPMISSINGLIST} "${_DEPMISSINGLIST}" PARENT_SCOPE)
117 ENDFUNCTION(OSG_GET_ALL_DEP_OSG_LIB)
119 #############################################################################
120 # register project with build
122 MACRO(OSG_ADD_PROJECT PNAME)
123     PROJECT(${PNAME})
124     IF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
125       OPTION(OSGBUILD_${PROJECT_NAME} "Build the ${PROJECT_NAME} library" ON)
126       IF(NOT OSG_DISABLE_SOURCE_GROUPS)
127         SET(${PROJECT_NAME}_SOURCE_GROUPS "" CACHE INTERNAL "" FORCE)
128       ENDIF()
129     ENDIF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
130 ENDMACRO(OSG_ADD_PROJECT)
132 #############################################################################
133 # qt wrapper
135 MACRO(OSG_QT_MAKE_OUTPUT_FILE ARG1 ARG2 ARG3 ARG4)
137   IF(QT4_FOUND)
138     QT4_MAKE_OUTPUT_FILE(${MOCFile} moc_ cpp MOCOutFile)
139   ENDIF()
141   IF(QT5_FOUND)
142     QT5_MAKE_OUTPUT_FILE(${MOCFile} moc_ cpp MOCOutFile)
143   ENDIF()
145 ENDMACRO()
147 #############################################################################
148 # select the current project as the one settings are added to
150 MACRO(OSG_SELECT_PROJECT)
152     IF(OSGBUILD_${PROJECT_NAME})
153         MESSAGE(STATUS "Processing ${PROJECT_NAME}")
154     ELSE(OSGBUILD_${PROJECT_NAME})
155         OSG_MSG("Skipping ${PROJECT_NAME}")
156         RETURN()
157     ENDIF(OSGBUILD_${PROJECT_NAME})
159     SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM TRUE)
161     SET(${PROJECT_NAME}_BUILD_FILE
162         "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.cmake")
163     SET(${PROJECT_NAME}_CONFIG_FILE
164         "${CMAKE_BINARY_DIR}/bin/osg2-config.part2.tmp")
166     # write header
167     IF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
168         FILE(WRITE ${${PROJECT_NAME}_BUILD_FILE}
169             "# ${PROJECT_NAME}.cmake -- auto generated\n\n")
171         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
172             "SET(${PROJECT_NAME}_SRC ${OSG_ADD_GLOBAL_SRC} ${${PROJECT_NAME}_ADD_SRC})\n")
173         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
174             "SET(${PROJECT_NAME}_HDR ${OSG_ADD_GLOBAL_HDR} ${${PROJECT_NAME}_ADD_HDR})\n")
175         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
176             "SET(${PROJECT_NAME}_HDR)\n")
177         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
178             "SET(${PROJECT_NAME}_INL)\n")
179         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
180             "SET(${PROJECT_NAME}_INS)\n")
181         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
182             "SET(${PROJECT_NAME}_FCD)\n")
183         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
184             "SET(${PROJECT_NAME}_LL)\n")
185         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
186             "SET(${PROJECT_NAME}_YY)\n")
187         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
188              "SET(${PROJECT_NAME}_MOC)\n")
189         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
190             "SET(${PROJECT_NAME}_UNITTEST_SRC)\n")
191         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
192             "SET(${PROJECT_NAME}_TEST_SRC)\n")
193         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
194             "SET(${PROJECT_NAME}_APP_SRC)\n")
195         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
196             "SET(${PROJECT_NAME}_INC)\n")
197         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
198             "SET(${PROJECT_NAME}_EXE_ADD_SRC ${OSG_ADD_GLOBAL_EXE_SRC})\n\n")
200         SET(${PROJECT_NAME}_HEADER_FILES "" CACHE INTERNAL "")
201     ENDIF(${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
203     # clear dependency variables
204     SET(${PROJECT_NAME}_DEP_OSG_LIB)
205     SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB)
206     SET(${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB)
207     SET(${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB)
209     SET(${PROJECT_NAME}_DEP_LIB)
210     SET(${PROJECT_NAME}_DEP_LIBDIR)
211     SET(${PROJECT_NAME}_DEP_INCDIR)
212     SET(${PROJECT_NAME}_DEP_SYS_INCDIR)
213     SET(${PROJECT_NAME}_DEP_DEFS)
215     SET(${PROJECT_NAME}_DEP_TEST_LIB)
216     SET(${PROJECT_NAME}_DEP_TEST_LIBDIR)
217     SET(${PROJECT_NAME}_DEP_TEST_INCDIR)
218     SET(${PROJECT_NAME}_DEP_TEST_SYS_INCDIR)
219     SET(${PROJECT_NAME}_DEP_TEST_DEFS)
221     SET(${PROJECT_NAME}_DEP_UNITTEST_LIB)
222     SET(${PROJECT_NAME}_DEP_UNITTEST_LIBDIR)
223     SET(${PROJECT_NAME}_DEP_UNITTEST_INCDIR)
225     SET(${PROJECT_NAME}_DEP_ADD_INCDIR)
227     SET(${PROJECT_NAME}_EXCL_FILES)
229     SET(${PROJECT_NAME}_BASE_DIR)
231     SET(${PROJECT_NAME}_SRC_PATTERNS)
232     SET(${PROJECT_NAME}_HDR_PATTERNS)
233     SET(${PROJECT_NAME}_INL_PATTERNS)
235     SET(${PROJECT_NAME}_SUFFIX)
237     SET(${PROJECT_NAME}_NO_DOC)
239     SET(${PROJECT_NAME}_NO_PYTHON)
240     SET(${PROJECT_NAME}_NO_DBG_INSTALL FALSE)
241     SET(${PROJECT_NAME}_ENABLE_WRITE_PYTHON_TO_SOURCE)
243 ENDMACRO(OSG_SELECT_PROJECT)
245 #############################################################################
246 # Extract separate libs and paths from a list of files.
248 # cmake stores libraries as full paths to the library file, this splits
249 # this form into a library (suitable for use on the linker command line) and
250 # the path where that library can be found.
251 FUNCTION(OSG_EXTRACT_LIB_AND_LIBDIR INLIBS OUTLIBS OUTLIBDIRS)
253     FOREACH(INLIB ${INLIBS})
254         GET_FILENAME_COMPONENT(INLIB_LIB    ${INLIB} NAME)
255         GET_FILENAME_COMPONENT(INLIB_LIBDIR ${INLIB} PATH)
257         STRING(REPLACE "${CMAKE_SHARED_LIBRARY_PREFIX}" "" INLIB_LIB ${INLIB_LIB})
258         STRING(REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}" "" INLIB_LIB ${INLIB_LIB})
260         LIST(APPEND OLIBS ${INLIB_LIB})
261         LIST(APPEND OLIBDIRS ${INLIB_LIBDIR})
262     ENDFOREACH(INLIB)
264     SET(${OUTLIBS} ${OLIBS} PARENT_SCOPE)
265     SET(${OUTLIBDIRS} ${OLIBDIRS} PARENT_SCOPE)
267 ENDFUNCTION(OSG_EXTRACT_LIB_AND_LIBDIR)
269 FUNCTION(OSG_EXTRACT_LIBDIR INLIBDIRS OUTLIBDIRS)
271     FOREACH(INLIBDIR ${INLIBDIRS})
272         LIST(APPEND OLIBDIRS ${INLIBDIR})
273     ENDFOREACH(INLIBDIR)
275     SET(${OUTLIBDIRS} ${OLIBDIRS} PARENT_SCOPE)
276 ENDFUNCTION(OSG_EXTRACT_LIBDIR)
278 FUNCTION(OSG_EXTRACT_INCDIR ININCDIRS OUTINCDIRS)
280     FOREACH(ININCDIR ${ININCDIRS})
281         LIST(APPEND OINCDIRS ${ININCDIR})
282     ENDFOREACH(ININCDIR)
284     SET(${OUTINCDIRS} ${OINCDIRS} PARENT_SCOPE)
285 ENDFUNCTION(OSG_EXTRACT_INCDIR)
287 #############################################################################
288 # write the dependecy variables to the ${${PROJECT_NAME}_BUILD_FILE} file
289 # for use during the build and to
290 # ${${PROJECT_NAME}_CONFIG_FILE} for constructing osg2-config
292 FUNCTION(OSG_STORE_PROJECT_DEPENDENCIES)
293     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
294         RETURN()
295     ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
297     IF(OSG_ENABLE_WRITE_PYTHON_TO_SOURCE OR ${PROJECT_NAME}_ENABLE_WRITE_PYTHON_TO_SOURCE)
298       SET(OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/module" CACHE INTERNAL "" FORCE)
299     ELSE()
300       IF(OSG_PYTHON_MODULE_BASE_DIR)
301         SET(OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR "${OSG_PYTHON_MODULE_BASE_DIR}/${PROJECT_NAME}/module" CACHE INTERNAL "" FORCE)
302       ELSE()
303         SET(OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR "${CMAKE_BINARY_DIR}/Python/${PROJECT_NAME}/module" CACHE INTERNAL "" FORCE)
304       ENDIF()
305     ENDIF()
307     #########################################
308     # store dependencies for the build
310     # dependencies - OpenSG
311     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
312         "SET(${PROJECT_NAME}_DEP_OSG_LIB ${${PROJECT_NAME}_DEP_OSG_LIB})\n")
313     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
314         "SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB ${${PROJECT_NAME}_DEP_TEST_OSG_LIB})\n\n")
315     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
316         "SET(${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB ${${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB})\n\n")
317     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
318         "SET(${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB ${${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB})\n\n")
320     # dependencies - external
321     IF(OSG_GLOBAL_LIB)
322       LIST(APPEND ${PROJECT_NAME}_DEP_LIB ${OSG_GLOBAL_LIB})
323     ENDIF(OSG_GLOBAL_LIB)
324     IF(${PROJECT_NAME}_ADD_LIB)
325       LIST(APPEND ${PROJECT_NAME}_DEP_LIB ${${PROJECT_NAME}_ADD_LIB})
326     ENDIF(${PROJECT_NAME}_ADD_LIB)
328     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
329         "SET(${PROJECT_NAME}_DEP_LIB ${${PROJECT_NAME}_DEP_LIB})\n")
330     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
331         "SET(${PROJECT_NAME}_DEP_LIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})\n")
332     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
333         "SET(${PROJECT_NAME}_DEP_INCDIR ${${PROJECT_NAME}_DEP_INCDIR})\n\n")
334     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
335         "SET(${PROJECT_NAME}_DEP_SYS_INCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})\n\n")
337     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
338         "SET(${PROJECT_NAME}_DEP_TEST_LIB ${${PROJECT_NAME}_DEP_TEST_LIB})\n")
339     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
340         "SET(${PROJECT_NAME}_DEP_TEST_LIBDIR ${${PROJECT_NAME}_DEP_TEST_LIBDIR})\n")
341     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
342         "SET(${PROJECT_NAME}_DEP_TEST_INCDIR ${${PROJECT_NAME}_DEP_TEST_INCDIR})\n\n")
343     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
344         "SET(${PROJECT_NAME}_DEP_TEST_SYS_INCDIR ${${PROJECT_NAME}_DEP_TEST_SYS_INCDIR})\n\n")
346     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
347         "SET(${PROJECT_NAME}_DEP_UNITTEST_LIB ${${PROJECT_NAME}_DEP_UNITTEST_LIB})\n")
348     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
349         "SET(${PROJECT_NAME}_DEP_UNITTEST_LIBDIR ${${PROJECT_NAME}_DEP_UNITTEST_LIBDIR})\n")
350     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
351         "SET(${PROJECT_NAME}_DEP_UNITTEST_INCDIR ${${PROJECT_NAME}_DEP_UNITTEST_INCDIR})\n\n")
353     # dependencies - additional
354     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
355         "SET(${PROJECT_NAME}_DEP_ADD_INCDIR ${${PROJECT_NAME}_DEP_ADD_INCDIR})\n\n")
356     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
357         "SET(${PROJECT_NAME}_DEP_DEFS ${${PROJECT_NAME}_DEP_DEFS})\n\n")
359     # for external projects
361     FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
362         "SET(${PROJECT_NAME}_DEP_OSG_LIB ${${PROJECT_NAME}_DEP_OSG_LIB})\n\n")
364     FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
365         "SET(${PROJECT_NAME}_DEP_LIB ${${PROJECT_NAME}_DEP_LIB})\n\n")
367     FILE(APPEND "${CMAKE_BINARY_DIR}/OpenSGExtDep.cmake"
368         "LIST(APPEND STORED_PROJECTS ${PROJECT_NAME})\n\n")
372     #########################################################################
373     # Store dependencies for osg2-config.
374     # This is a bit lengthy as it writes a python dictionary
376     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
377         "############################################################\n")
378     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
379         "## Dependecies for ${PROJECT_NAME}\n\n")
381     # OpenSG libraries this lib depends on
382     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
383         "\"${PROJECT_NAME}\" : {\n")
384     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
385         "    \"dep_osg_lib\"  :  [")
387     FOREACH(DEPOSGLIB ${${PROJECT_NAME}_DEP_OSG_LIB})
388         FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
389             " \"${DEPOSGLIB}\", ")
390     ENDFOREACH(DEPOSGLIB)
392     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
393         " ],\n")
395     # global dependencies
396     FOREACH(DEPLIB ${OSG_GLOBAL_DEP_LIBS})
397         OSG_EXTRACT_LIB_AND_LIBDIR("${${DEPLIB}}" LIBS LIBDIRS)
399         FOREACH(LIB ${LIBS})
400             # if the lib is an import target, get the location and
401             # split that into library name and path
403             IF(TARGET ${LIB})
404                 GET_TARGET_PROPERTY(_LIB_LOCATION ${LIB} IMPORTED_LOCATION)
406                 OSG_EXTRACT_LIB_AND_LIBDIR("${_LIB_LOCATION}" _LIBS _LIBDIRS)
408                 LIST(APPEND DEPLIBS    ${_LIBS})
409                 LIST(APPEND DEPLIBDIRS ${_LIBDIRS})
410             ELSE(TARGET ${LIB})
411                 LIST(APPEND DEPLIBS ${LIB})
412             ENDIF(TARGET ${LIB})
413         ENDFOREACH(LIB)
415         LIST(APPEND DEPLIBDIRS ${LIBDIRS})
416     ENDFOREACH(DEPLIB)
418     FOREACH(DEPLIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
419         OSG_EXTRACT_LIBDIR("${${DEPLIBDIR}}" LIBDIRS)
421         LIST(APPEND DEPLIBDIRS ${LIBDIRS})
422     ENDFOREACH(DEPLIBDIR)
424     FOREACH(DEPINCDIR ${OSG_GLOBAL_DEP_INCDIR})
425         OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
427         LIST(APPEND DEPINCDIRS ${INCDIRS})
428     ENDFOREACH(DEPINCDIR)
430     FOREACH(DEPINCDIR ${OSG_SYSTEM_DEP_INCDIR})
431         OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
433         LIST(APPEND DEPINCDIRS ${INCDIRS})
434     ENDFOREACH(DEPINCDIR)
436     # External libraries this lib depends on
437     # we build lists of libs, libdirs and incdirs then write them
438     FOREACH(DEPLIB ${${PROJECT_NAME}_DEP_LIB})
439         OSG_EXTRACT_LIB_AND_LIBDIR("${${DEPLIB}}" LIBS LIBDIRS)
441         FOREACH(LIB ${LIBS})
442             # if the lib is an import target, get the location and
443             # split that into library name and path
445             IF(TARGET ${LIB})
446                 GET_TARGET_PROPERTY(_LIB_LOCATION ${LIB} IMPORTED_LOCATION)
448                 OSG_EXTRACT_LIB_AND_LIBDIR("${_LIB_LOCATION}" _LIBS _LIBDIRS)
450                 LIST(APPEND DEPLIBS    ${_LIBS})
451                 LIST(APPEND DEPLIBDIRS ${_LIBDIRS})
452             ELSE(TARGET ${LIB})
453                 LIST(APPEND DEPLIBS ${LIB})
454             ENDIF(TARGET ${LIB})
455         ENDFOREACH(LIB)
457         LIST(APPEND DEPLIBDIRS ${LIBDIRS})
458     ENDFOREACH(DEPLIB)
460     FOREACH(DEPLIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})
461         OSG_EXTRACT_LIBDIR("${${DEPLIBDIR}}" LIBDIRS)
463         LIST(APPEND DEPLIBDIRS ${LIBDIRS})
464     ENDFOREACH(DEPLIBDIR)
466     FOREACH(DEPINCDIR ${${PROJECT_NAME}_DEP_INCDIR})
467         OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
469         LIST(APPEND DEPINCDIRS ${INCDIRS})
470     ENDFOREACH(DEPINCDIR)
472     FOREACH(DEPINCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})
473         OSG_EXTRACT_INCDIR("${${DEPINCDIR}}" INCDIRS)
475         LIST(APPEND DEPINCDIRS ${INCDIRS})
476     ENDFOREACH(DEPINCDIR)
478     IF(DEPLIBS)
479         LIST(REMOVE_DUPLICATES DEPLIBS)
480     ENDIF(DEPLIBS)
482     IF(DEPLIBDIRS)
483         LIST(REMOVE_DUPLICATES DEPLIBDIRS)
484     ENDIF(DEPLIBDIRS)
486     IF(DEPINCDIRS)
487         LIST(REMOVE_DUPLICATES DEPINCDIRS)
488     ENDIF(DEPINCDIRS)
490     IF(DEPLIBS OR DEPLIBDIRS OR DEPINCDIRS)
491         OSG_MSG("   DEPLIBS: ${DEPLIBS}")
492         OSG_MSG("   DEPLIBDIRS: ${DEPLIBDIRS}")
493         OSG_MSG("   DEPINCDIRS: ${DEPINCDIRS}")
494     ENDIF(DEPLIBS OR DEPLIBDIRS OR DEPINCDIRS)
496     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
497         "    \"dep_lib\"  :  [")
499     FOREACH(LIB ${DEPLIBS})
500         FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
501             " \"${LIB}\", ")
502     ENDFOREACH(LIB)
504     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
505         " ],\n")
506     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
507         "    \"dep_lib_dir\"  :  [")
509     FOREACH(LIBDIR ${DEPLIBDIRS})
510         FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
511             " \"${LIBDIR}\", ")
512     ENDFOREACH(LIBDIR)
514     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
515         " ],\n")
517     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
518         "    \"dep_inc_dir\"  :  [")
520     FOREACH(INCDIR ${DEPINCDIRS})
521         FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
522             " \"${INCDIR}\", ")
523     ENDFOREACH(INCDIR)
525     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
526         " ],\n")
528     FILE(APPEND ${${PROJECT_NAME}_CONFIG_FILE}
529         "},\n")
531 ENDFUNCTION(OSG_STORE_PROJECT_DEPENDENCIES)
534 #############################################################################
535 # add directory DIRNAME to current project
537 FUNCTION(OSG_ADD_DIRECTORY DIRNAME)
539     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
540         RETURN()
541     ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGCOLLECT")
543     OSG_MSG("Adding directory: ${DIRNAME}")
545     SET(_OSG_ADD_SRC_LOOKUP)
546     SET(_OSG_ADD_HDR_LOOKUP)
547     SET(_OSG_ADD_INL_LOOKUP)
548     SET(_OSG_ADD_INS_LOOKUP)
549     SET(_OSG_ADD_LL_LOOKUP)
550     SET(_OSG_ADD_YY_LOOKUP)
551     SET(_OSG_ADD_QTH_LOOKUP)
553     IF(EXISTS "${CMAKE_SOURCE_DIR}/${DIRNAME}")
554         SET(_OSG_CURR_DIRNAME "${CMAKE_SOURCE_DIR}/${DIRNAME}")
556         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
557           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.cpp")
558           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.cc")
559           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.mm")
560         ENDFOREACH()
562         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
563           LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.h")
564         ENDFOREACH()
566         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
567           LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.inl")
568         ENDFOREACH()
570         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
571           LIST(APPEND _OSG_ADD_INS_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ins")
572         ENDFOREACH()
574         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
575           LIST(APPEND _OSG_ADD_LL_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ll")
576         ENDFOREACH()
578         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
579           LIST(APPEND _OSG_ADD_YY_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.yy")
580         ENDFOREACH()
582         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
583           LIST(APPEND _OSG_ADD_QTH_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*_qt.h")
584         ENDFOREACH()
587         FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_SRC_PATTERNS})
588           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
589         ENDFOREACH()
591         FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_HDR_PATTERNS})
592           LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
593         ENDFOREACH()
595         FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_INL_PATTERNS})
596           LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
597         ENDFOREACH()
599         FILE(GLOB LOCAL_SRC          #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.cpp"
600                                      #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.mm"
601                                       ${_OSG_ADD_SRC_LOOKUP}                  )
602         FILE(GLOB LOCAL_HDR          #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.h"
603                                       ${_OSG_ADD_HDR_LOOKUP}                  )
604         FILE(GLOB LOCAL_INL          #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.inl"
605                                       ${_OSG_ADD_INL_LOOKUP}                  )
606         FILE(GLOB LOCAL_INS          #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.ins"
607                                       ${_OSG_ADD_INS_LOOKUP}                  )
608         FILE(GLOB LOCAL_LL           #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.ll"
609                                       ${_OSG_ADD_LL_LOOKUP}                   )
610         FILE(GLOB LOCAL_YY           #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.yy"
611                                       ${_OSG_ADD_YY_LOOKUP}                   )
612         FILE(GLOB LOCAL_MOC          #"${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*_qt.h"
613                                       ${_OSG_ADD_QTH_LOOKUP}                  )
615         FILE(GLOB LOCAL_FCD          "${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*.fcd")
616         FILE(GLOB LOCAL_UNITTEST_SRC "${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*Test.cpp")
617         FILE(GLOB LOCAL_TEST_SRC     "${CMAKE_SOURCE_DIR}/${DIRNAME}/test*.cpp"
618                                      "${CMAKE_SOURCE_DIR}/${DIRNAME}/test*.mm")
619         FILE(GLOB LOCAL_APP_SRC      "${CMAKE_SOURCE_DIR}/${DIRNAME}/app*.cpp")
620         FILE(GLOB BASE_MM            "${CMAKE_SOURCE_DIR}/${DIRNAME}/OSG*Base.mm")
621     ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
622         SET(_OSG_CURR_DIRNAME "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
624         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
625           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.cpp"
626                                           "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.mm")
627         ENDFOREACH()
629         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
630           LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.h")
631         ENDFOREACH()
633         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
634           LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.inl")
635         ENDFOREACH()
637         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
638           LIST(APPEND _OSG_ADD_INS_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ins")
639         ENDFOREACH()
641         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
642           LIST(APPEND _OSG_ADD_LL_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.ll")
643         ENDFOREACH()
645         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
646           LIST(APPEND _OSG_ADD_YY_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*.yy")
647         ENDFOREACH()
649         FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
650           LIST(APPEND _OSG_ADD_QTH_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PREFIX}*_qt.h")
651         ENDFOREACH()
654         FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_SRC_PATTERNS})
655           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
656         ENDFOREACH()
658         FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_HDR_PATTERNS})
659           LIST(APPEND _OSG_ADD_HDR_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
660         ENDFOREACH()
662         FOREACH(_OSG_FILE_PATTERN ${${PROJECT_NAME}_INL_PATTERNS})
663           LIST(APPEND _OSG_ADD_INL_LOOKUP "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/${_OSG_FILE_PATTERN}")
664         ENDFOREACH()
666         FILE(GLOB LOCAL_SRC          #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.cpp"
667                                      #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.mm"
668                                       ${_OSG_ADD_SRC_LOOKUP}                          )
669         FILE(GLOB LOCAL_HDR          #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.h"
670                                      ${_OSG_ADD_HDR_LOOKUP}                           )
671         FILE(GLOB LOCAL_INL          #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.inl"
672                                      ${_OSG_ADD_INL_LOOKUP}                           )
673         FILE(GLOB LOCAL_INS          #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.ins"
674                                       ${_OSG_ADD_INS_LOOKUP}                          )
675         FILE(GLOB LOCAL_LL           #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.ll"
676                                       ${_OSG_ADD_LL_LOOKUP}                           )
677         FILE(GLOB LOCAL_YY           #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.yy"
678                                       ${_OSG_ADD_YY_LOOKUP}                           )
679         FILE(GLOB LOCAL_MOC          #"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*_qt.h"
680                                       ${_OSG_ADD_QTH_LOOKUP}                          )
682         FILE(GLOB LOCAL_FCD          "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*.fcd")
683         FILE(GLOB LOCAL_UNITTEST_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*Test.cpp")
684         FILE(GLOB LOCAL_TEST_SRC     "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/test*.cpp"
685                                      "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/test*.mm")
686         FILE(GLOB LOCAL_APP_SRC      "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/app*.cpp")
687         FILE(GLOB BASE_MM            "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}/OSG*Base.mm")
688     ELSE()
689         SET(_OSG_CURR_DIRNAME "${DIRNAME}")
691         IF(OSGPREFIX)
692           FOREACH(_OSG_FILE_PREFIX ${OSGPREFIX})
693             LIST(APPEND _OSG_ADD_SRC_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.cpp"
694                                             "${DIRNAME}/${_OSG_FILE_PREFIX}*.mm")
695             LIST(APPEND _OSG_ADD_HDR_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.h")
697             LIST(APPEND _OSG_ADD_INL_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.inl")
698             LIST(APPEND _OSG_ADD_INS_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.ins")
699             LIST(APPEND _OSG_ADD_LL_LOOKUP  "${DIRNAME}/${_OSG_FILE_PREFIX}*.ll")
700             LIST(APPEND _OSG_ADD_YY_LOOKUP  "${DIRNAME}/${_OSG_FILE_PREFIX}*.yy")
701             LIST(APPEND _OSG_ADD_LPP_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*.lpp")
702             LIST(APPEND _OSG_ADD_Y_LOOKUP   "${DIRNAME}/${_OSG_FILE_PREFIX}*.y")
703             LIST(APPEND _OSG_ADD_QTH_LOOKUP "${DIRNAME}/${_OSG_FILE_PREFIX}*_qt.h")
705             LIST(APPEND _OSG_ADD_SRC_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
706             LIST(APPEND _OSG_ADD_HDR_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
707             LIST(APPEND _OSG_ADD_INL_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
708           ENDFOREACH()
709         ELSE()
710           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${DIRNAME}/*.cpp"
711                                           "${DIRNAME}/*.mm")
712           LIST(APPEND _OSG_ADD_HDR_LOOKUP "${DIRNAME}/*.h")
714           LIST(APPEND _OSG_ADD_INL_LOOKUP "${DIRNAME}/*.inl")
715           LIST(APPEND _OSG_ADD_INS_LOOKUP "${DIRNAME}/*.ins")
716           LIST(APPEND _OSG_ADD_LL_LOOKUP  "${DIRNAME}/*.ll")
717           LIST(APPEND _OSG_ADD_YY_LOOKUP  "${DIRNAME}/*.yy")
718           LIST(APPEND _OSG_ADD_LPP_LOOKUP "${DIRNAME}/*.lpp")
719           LIST(APPEND _OSG_ADD_Y_LOOKUP   "${DIRNAME}/*.y")
720           LIST(APPEND _OSG_ADD_QTH_LOOKUP "${DIRNAME}/*_qt.h")
722           LIST(APPEND _OSG_ADD_SRC_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
723           LIST(APPEND _OSG_ADD_HDR_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
724           LIST(APPEND _OSG_ADD_INL_LOOKUP "${DIRNAME}/${_OSG_FILE_PATTERN}")
725         ENDIF()
726         # Guess it's an absolute dir we got as the rel one is not there
727         FILE(GLOB LOCAL_SRC          #"${DIRNAME}/OSG*.cpp" 
728                                      #"${DIRNAME}/OSG*.mm"
729                                       ${_OSG_ADD_SRC_LOOKUP})
730         FILE(GLOB LOCAL_HDR          #"${DIRNAME}/OSG*.h"
731                                       ${_OSG_ADD_HDR_LOOKUP})
732         FILE(GLOB LOCAL_INL          #"${DIRNAME}/OSG*.inl"
733                                       ${_OSG_ADD_INL_LOOKUP})
734         FILE(GLOB LOCAL_INS          #"${DIRNAME}/OSG*.ins"
735                                       ${_OSG_ADD_INS_LOOKUP})
736         FILE(GLOB LOCAL_LL           #"${DIRNAME}/OSG*.ll"
737                                       ${_OSG_ADD_LL_LOOKUP} )
738         FILE(GLOB LOCAL_YY           #"${DIRNAME}/OSG*.yy"
739                                       ${_OSG_ADD_YY_LOOKUP} )
740         FILE(GLOB LOCAL_MOC          #"${DIRNAME}/OSG*_qt.h"
741                                       ${_OSG_ADD_QTH_LOOKUP})
743         FILE(GLOB LOCAL_FCD          "${DIRNAME}/OSG*.fcd")
744         FILE(GLOB LOCAL_UNITTEST_SRC "${DIRNAME}/OSG*Test.cpp")
745         FILE(GLOB LOCAL_TEST_SRC     "${DIRNAME}/test*.cpp"
746                                      "${DIRNAME}/test*.mm")
747         FILE(GLOB LOCAL_APP_SRC      "${DIRNAME}/app*.cpp")
748         FILE(GLOB BASE_MM            "${DIRNAME}/OSG*Base.mm")
749     ENDIF()
751     IF(BASE_MM)
752         FOREACH(BaseMMFile ${BASE_MM})
753         STRING(REGEX REPLACE mm$ cpp BaseMMFileCPP ${BaseMMFile})
754         LIST(APPEND BASE_MM_CPP ${BaseMMFileCPP})
755     ENDFOREACH()
756     ENDIF(BASE_MM)
758     IF(BASE_MM_CPP)
759         LIST(REMOVE_ITEM LOCAL_SRC ${BASE_MM_CPP})
760     ENDIF(BASE_MM_CPP)
762     IF(${PROJECT_NAME}_EXCL_FILES)
763         LIST(REMOVE_ITEM LOCAL_SRC          ${${PROJECT_NAME}_EXCL_FILES})
764         LIST(REMOVE_ITEM LOCAL_HDR          ${${PROJECT_NAME}_EXCL_FILES})
765         LIST(REMOVE_ITEM LOCAL_INL          ${${PROJECT_NAME}_EXCL_FILES})
766         LIST(REMOVE_ITEM LOCAL_INS          ${${PROJECT_NAME}_EXCL_FILES})
767         LIST(REMOVE_ITEM LOCAL_FCD          ${${PROJECT_NAME}_EXCL_FILES})
768         LIST(REMOVE_ITEM LOCAL_LL           ${${PROJECT_NAME}_EXCL_FILES})
769         LIST(REMOVE_ITEM LOCAL_YY           ${${PROJECT_NAME}_EXCL_FILES})
770         LIST(REMOVE_ITEM LOCAL_UNITTEST_SRC ${${PROJECT_NAME}_EXCL_FILES})
771         LIST(REMOVE_ITEM LOCAL_TEST_SRC     ${${PROJECT_NAME}_EXCL_FILES})
772         LIST(REMOVE_ITEM LOCAL_APP_SRC      ${${PROJECT_NAME}_EXCL_FILES})
773     ENDIF(${PROJECT_NAME}_EXCL_FILES)
775     # filter unittest sources out of library sources
776     IF(LOCAL_UNITTEST_SRC)
777         LIST(REMOVE_ITEM LOCAL_SRC ${LOCAL_UNITTEST_SRC})
778     ENDIF(LOCAL_UNITTEST_SRC)
780     # store file lists
781     FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE} "# File lists for ${DIRNAME}\n\n")
783     # library sources
784     IF(LOCAL_SRC)
785         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
786              "LIST(APPEND ${PROJECT_NAME}_SRC \"${LOCAL_SRC}\")\n\n")
787     ENDIF(LOCAL_SRC)
789     IF(LOCAL_HDR)
790         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
791              "LIST(APPEND ${PROJECT_NAME}_HDR \"${LOCAL_HDR}\")\n\n")
792         SET(${PROJECT_NAME}_HEADER_FILES "${${PROJECT_NAME}_HEADER_FILES} ${LOCAL_HDR}" CACHE INTERNAL "")
793     ENDIF(LOCAL_HDR)
795     IF(LOCAL_INL)
796         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
797              "LIST(APPEND ${PROJECT_NAME}_INL \"${LOCAL_INL}\")\n\n")
798         SET(${PROJECT_NAME}_HEADER_FILES "${${PROJECT_NAME}_HEADER_FILES} ${LOCAL_INL}" CACHE INTERNAL "")
799     ENDIF(LOCAL_INL)
801     IF(LOCAL_INS)
802         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
803              "LIST(APPEND ${PROJECT_NAME}_INS \"${LOCAL_INS}\")\n\n")
804         SET(${PROJECT_NAME}_HEADER_FILES "${${PROJECT_NAME}_HEADER_FILES} ${LOCAL_INS}" CACHE INTERNAL "")
805     ENDIF(LOCAL_INS)
807     IF(LOCAL_FCD)
808         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
809              "LIST(APPEND ${PROJECT_NAME}_FCD \"${LOCAL_FCD}\")\n\n")
810     ENDIF(LOCAL_FCD)
812     IF(LOCAL_LL)
813         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
814              "LIST(APPEND ${PROJECT_NAME}_LL \"${LOCAL_LL}\")\n\n")
815     ENDIF(LOCAL_LL)
817     IF(LOCAL_YY)
818         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
819              "LIST(APPEND ${PROJECT_NAME}_YY \"${LOCAL_YY}\")\n\n")
820     ENDIF(LOCAL_YY)
822     IF(LOCAL_MOC)
823         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
824              "LIST(APPEND ${PROJECT_NAME}_MOC \"${LOCAL_MOC}\")\n\n")
825     ENDIF(LOCAL_MOC)
827     IF(NOT OSG_DISABLE_SOURCE_GROUPS)
828       IF(NOT ${PROJECT_NAME}_BASE_DIR)
829         # Add the source files to the source group
830         #Strip the path down to a relative one
831         IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
832           FILE(RELATIVE_PATH THE_SOURCE_GROUP
833                              ${CMAKE_CURRENT_SOURCE_DIR}/Source
834                              ${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME})
835         ELSEIF(EXISTS "${CMAKE_SOURCE_DIR}/${DIRNAME}")
836           FILE(RELATIVE_PATH THE_SOURCE_GROUP
837                              ${CMAKE_SOURCE_DIR}/Source
838                              ${CMAKE_SOURCE_DIR}/${DIRNAME})
839         ELSE()
840           FILE(RELATIVE_PATH THE_SOURCE_GROUP
841                              ${CMAKE_SOURCE_DIR}/Source
842                              ${CMAKE_SOURCE_DIR}/${DIRNAME})
843         ENDIF()
844       ELSE()
845           FILE(RELATIVE_PATH THE_SOURCE_GROUP
846                              ${${PROJECT_NAME}_BASE_DIR}/
847                              ${_OSG_CURR_DIRNAME})
848       ENDIF()
850       IF(THE_SOURCE_GROUP)
851            STRING(REPLACE "/" "\\" THE_SOURCE_GROUP ${THE_SOURCE_GROUP})
852       ELSE(THE_SOURCE_GROUP)
853            SET(THE_SOURCE_GROUP "Source")
854       ENDIF(THE_SOURCE_GROUP)
856       IF(${THE_SOURCE_GROUP} STREQUAL "\\")
857            SET(THE_SOURCE_GROUP "Source")
858       ENDIF()
860       LIST(APPEND ${PROJECT_NAME}_SOURCE_GROUPS ${THE_SOURCE_GROUP})
861       SET(${PROJECT_NAME}_SOURCE_GROUPS ${${PROJECT_NAME}_SOURCE_GROUPS}
862                                         CACHE INTERNAL "" FORCE)
864       STRING(REPLACE "\\" "_" THE_SOURCE_GROUP ${THE_SOURCE_GROUP})
865       LIST(APPEND ${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}
866                   ${LOCAL_SRC}
867                   ${LOCAL_HDR}
868                   ${LOCAL_INL}
869                   ${LOCAL_INS}
870                   ${LOCAL_FCD}
871                   ${LOCAL_LL}
872                   ${LOCAL_YY}
873                   ${LOCAL_MOC})
875       SET(${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}
876             ${${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}}
877             CACHE INTERNAL "" FORCE)
879     ENDIF(NOT OSG_DISABLE_SOURCE_GROUPS)
881     # unittests
882     IF(LOCAL_UNITTEST_SRC)
883         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
884             "LIST(APPEND ${PROJECT_NAME}_UNITTEST_SRC \"${LOCAL_UNITTEST_SRC}\")\n\n")
885     ENDIF(LOCAL_UNITTEST_SRC)
887     # tests
888     IF(LOCAL_TEST_SRC)
889         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
890              "LIST(APPEND ${PROJECT_NAME}_TEST_SRC \"${LOCAL_TEST_SRC}\")\n\n")
891     ENDIF(LOCAL_TEST_SRC)
893     # apps
894     IF(LOCAL_APP_SRC)
895         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
896              "LIST(APPEND ${PROJECT_NAME}_APP_SRC \"${LOCAL_APP_SRC}\")\n\n")
897     ENDIF(LOCAL_APP_SRC)
899     IF(EXISTS "${CMAKE_SOURCE_DIR}/${DIRNAME}")
900         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
901              "LIST(APPEND ${PROJECT_NAME}_INC \"${CMAKE_SOURCE_DIR}/${DIRNAME}\")\n\n")
902     ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}")
903         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
904              "LIST(APPEND ${PROJECT_NAME}_INC \"${CMAKE_CURRENT_SOURCE_DIR}/${DIRNAME}\")\n\n")
905     ELSE()
906         FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
907              "LIST(APPEND ${PROJECT_NAME}_INC \"${DIRNAME}\")\n\n")
908     ENDIF()
909 ENDFUNCTION(OSG_ADD_DIRECTORY)
912 #############################################################################
913 # perform default actions for pass OSGSETUP
915 FUNCTION(OSG_SETUP_LIBRARY_BUILD PROJ_DEFINE)
917     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUP")
918         RETURN()
919     ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUP")
921     IF(${PROJECT_NAME}_NO_LIB)
922         RETURN()
923     ENDIF()
925     # read file lists
926     OSG_CHECKED_INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
928     #####
929     # FCD
930     #####
932     IF(OSG_ENABLE_FCD2CODE AND PYTHONINTERP_FOUND)
934         FOREACH(FCDFile ${${PROJECT_NAME}_FCD})
935             GET_FILENAME_COMPONENT(FCDBase ${FCDFile} NAME_WE)
936             GET_FILENAME_COMPONENT(FCDDir  ${FCDFile} PATH)
938             SET(FCDBaseHdr "${FCDBase}Base.h")
939             SET(FCDBaseCpp "${FCDBase}Base.cpp")
940             SET(FCDBaseInl "${FCDBase}Base.inl")
941             SET(FCDBaseFld "${FCDBase}Fields.h")
943             SET(FCDClassHdr "${FCDBase}.h")
944             SET(FCDClassCpp "${FCDBase}.cpp")
945             SET(FCDClassInl "${FCDBase}.inl")
947             IF(NOT EXISTS ${FCDDir}/${FCDBaseCpp})
948                 SET(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${FCDDir}/${FCDBaseCpp})
949                 SET(${PROJECT_NAME}_HDR ${${PROJECT_NAME}_HDR} ${FCDDir}/${FCDBaseHdr})
950                 SET(${PROJECT_NAME}_INL ${${PROJECT_NAME}_INL} ${FCDDir}/${FCDBaseInl})
951                 SET(${PROJECT_NAME}_HDR ${${PROJECT_NAME}_HDR} ${FCDDir}/${FCDBaseFld})
953                 IF(NOT EXISTS ${FCDDir}/${FCDClassHdr})
954                     SET(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${FCDDir}/${FCDClassCpp})
955                     SET(${PROJECT_NAME}_HDR ${${PROJECT_NAME}_HDR} ${FCDDir}/${FCDClassHdr})
956                     SET(${PROJECT_NAME}_INL ${${PROJECT_NAME}_INL} ${FCDDir}/${FCDClassInl})
958                     SET(FCD_TMP_OUT ${FCDDir}/${FCDClassCpp}
959                                     ${FCDDir}/${FCDClassHdr}
960                                     ${FCDDir}/${FCDClassInl})
961                 ENDIF(NOT EXISTS ${FCDDir}/${FCDClassHdr})
962             ENDIF(NOT EXISTS ${FCDDir}/${FCDBaseCpp})
964             SET(FCDBaseDir ${CMAKE_SOURCE_DIR}/Tools/fcd2code)
965             SET(FCDCommand ${CMAKE_SOURCE_DIR}/Tools/fcd2code/fcd2code)
966             SET(FCDRoot -r ${CMAKE_SOURCE_DIR})
967             SET(FCDTemp "")
969             SET(FCDPath ${CMAKE_SOURCE_DIR}/Tools/fcd2code)
971             IF(NOT EXISTS FCDPath AND OpenSG_DIR) #external setup
972               SET(FCDBaseDir ${OpenSG_DIR}/bin/fcd2code)
974               SET(FCDCommand ${OpenSG_DIR}/bin/fcd2code/fcd2code)
976               SET(FCDRoot "")
977               SET(FCDTemp -t ${FCDBaseDir})
978             ENDIF(NOT EXISTS FCDPath AND OpenSG_DIR)
980             IF(NOT EXISTS ${FCDDir}/${FCDClassHdr} AND
981                NOT EXISTS ${FCDDir}/${FCDClassCpp} AND
982                NOT EXISTS ${FCDDir}/${FCDClassInl} AND
983                OSG_FCD2CODE_WRITE_CLASS              )
985                SET(_OSG_IGNORE_CLASSWRITE -1)
987                IF(OSG_IGNORE_CLASSBUILD)
988                  LIST(FIND OSG_IGNORE_CLASSBUILD ${FCDBase} _OSG_IGNORE_CLASSWRITE)
989                ENDIF(OSG_IGNORE_CLASSBUILD)
991                IF(_OSG_IGNORE_CLASSWRITE EQUAL -1)
992                  MESSAGE(STATUS "writing ${FCDDir}/${FCDClassHdr} ${FCDDir}/${FCDClassCpp} ${FCDDir}/${FCDClassInl}")
994                  EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${FCDCommand} -c -f -d ${FCDFile} -p ${FCDDir} ${FCDRoot} ${FCDTemp})
995                ENDIF(_OSG_IGNORE_CLASSWRITE EQUAL -1)
997             ENDIF()
999             ADD_CUSTOM_COMMAND(
1000                 OUTPUT ${FCDDir}/${FCDBaseHdr}
1001                        ${FCDDir}/${FCDBaseCpp}
1002                        ${FCDDir}/${FCDBaseInl}
1003                        ${FCDDir}/${FCDBaseFld}
1004                        ${FCD_TMP_OUT}
1005                 COMMAND ${PYTHON_EXECUTABLE} ${FCDCommand} -c -b -d ${FCDFile} -p ${FCDDir} ${FCDRoot} ${FCDTemp}
1006                 MAIN_DEPENDENCY ${FCDFile}
1007                 DEPENDS ${FCDBaseDir}/TemplateFieldContainerBase_h.txt
1008                         ${FCDBaseDir}/TemplateFieldContainerBase_inl.txt
1009                         ${FCDBaseDir}/TemplateFieldContainerBase_cpp.txt
1010                         ${FCDBaseDir}/TemplateFieldContainerFields_h.txt)
1012             SET(FCD_TMP_OUT )
1013         ENDFOREACH(FCDFile)
1015     ENDIF(OSG_ENABLE_FCD2CODE AND PYTHONINTERP_FOUND)
1017     ############
1018     # Qt4
1019     ############
1021     IF(${PROJECT_NAME}_MOC)
1022         # Here only the OSG_WITH_QT define is passes to qt moc.
1023         SET(moc_flags -DOSG_WITH_QT)
1025         SET(${PROJECT_NAME}_INC ${${PROJECT_NAME}_INC} ${CMAKE_CURRENT_BINARY_DIR})
1027         FOREACH(MOCFile ${${PROJECT_NAME}_MOC})
1028             GET_FILENAME_COMPONENT(MOCFile ${MOCFile} ABSOLUTE)
1029             OSG_QT_MAKE_OUTPUT_FILE(${MOCFile} moc_ cpp MOCOutFile)
1031             ADD_CUSTOM_COMMAND(
1032                 OUTPUT ${MOCOutFile}
1033                 COMMAND ${QT_MOC_EXECUTABLE}
1034                 ARGS ${moc_flags} ${moc_options} -o ${MOCOutFile} ${MOCFile}
1035                 DEPENDS ${MOCFile})
1036             LIST(APPEND ${PROJECT_NAME}_SRC ${MOCOutFile})
1037         ENDFOREACH(MOCFile)
1038     ENDIF(${PROJECT_NAME}_MOC)
1040     ############
1041     # Flex/Bison
1042     ############
1044     IF(OSG_ENABLE_SCANPARSE_REGEN AND FLEX_EXE AND BISON_EXE)
1046         FOREACH(YYFile ${${PROJECT_NAME}_YY})
1048             GET_FILENAME_COMPONENT(YYBase ${YYFile} NAME_WE)
1050             STRING(REPLACE "Parser" "_" YYOpt ${YYBase})
1052             SET(YYSrc ${CMAKE_CURRENT_BINARY_DIR}/${YYBase}.cpp)
1053             SET(YYHdr ${CMAKE_CURRENT_BINARY_DIR}/${YYBase}.hpp)
1055             ADD_CUSTOM_COMMAND(
1056                 OUTPUT ${YYSrc} ${YYHdr}
1057                 COMMAND ${BISON_EXE} -d -v -p${YYOpt} -b${YYOpt} -o ${YYSrc} ${YYFile}
1058                 MAIN_DEPENDENCY ${YYFile})
1060             LIST(APPEND ${PROJECT_NAME}_SRC ${YYSrc})
1061             LIST(APPEND ${PROJECT_NAME}_HDR ${YYHdr})
1063         ENDFOREACH()
1065         FOREACH(LLFile ${${PROJECT_NAME}_LL})
1067             GET_FILENAME_COMPONENT(LLBase ${LLFile} NAME_WE)
1069             STRING(REPLACE "Scanner" "_" LLOpt ${LLBase})
1071             IF(OSG_USE_OSG2_NAMESPACE)
1072               STRING(REPLACE "OSG" "OSG2"
1073                      LLOpt_VERSIONED
1074                      ${LLOpt})
1075             ELSE()
1076               SET(LLOpt_VERSIONED ${LLOpt})
1077             ENDIF()
1079             SET(LLSrc ${CMAKE_CURRENT_BINARY_DIR}/${LLBase}.cpp)
1081             ADD_CUSTOM_COMMAND(
1082                 OUTPUT ${LLSrc}
1083                 COMMAND ${FLEX_EXE} -+ -P${LLOpt_VERSIONED} -t ${LLFile} >  ${LLSrc}
1084                 MAIN_DEPENDENCY ${LLFile})
1086             SET(${PROJECT_NAME}_SRC ${${PROJECT_NAME}_SRC} ${LLSrc})
1088         ENDFOREACH()
1090         IF(${PROJECT_NAME}_YY OR ${PROJECT_NAME}_LL)
1091             SET(${PROJECT_NAME}_INC ${${PROJECT_NAME}_INC} ${CMAKE_CURRENT_BINARY_DIR})
1093             FILE(APPEND ${${PROJECT_NAME}_BUILD_FILE}
1094                 "LIST(APPEND ${PROJECT_NAME}_INC \"${CMAKE_CURRENT_BINARY_DIR}\")\n\n")
1096         ENDIF(${PROJECT_NAME}_YY OR ${PROJECT_NAME}_LL)
1098     ENDIF(OSG_ENABLE_SCANPARSE_REGEN AND FLEX_EXE AND BISON_EXE)
1100     ###############
1101     # build the lib
1102     ###############
1104     ## LINK_DIRS have to go first, before the ADD_LIB statement
1106     FOREACH(LIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
1107         OSG_MSG("  (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1108         LINK_DIRECTORIES(${${LIBDIR}})
1109     ENDFOREACH(LIBDIR)
1111     FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})
1112         OSG_MSG("  (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1113         LINK_DIRECTORIES(${${LIBDIR}})
1114     ENDFOREACH(LIBDIR)
1117     IF(NOT OSG_DISABLE_SOURCE_GROUPS)
1118       #Add Source Files to Source Groups
1119       #Loop through all of the groups for this Project
1120       FOREACH(PROJECT_SOURCE_GROUP_NAME ${${PROJECT_NAME}_SOURCE_GROUPS})
1121         STRING(REPLACE "\\" "_" THE_SOURCE_GROUP ${PROJECT_SOURCE_GROUP_NAME})
1122         SOURCE_GROUP(${PROJECT_SOURCE_GROUP_NAME} FILES
1123                      ${${PROJECT_NAME}_SOURCE_GROUP_${THE_SOURCE_GROUP}})
1124       ENDFOREACH(PROJECT_SOURCE_GROUP_NAME)
1125     ENDIF(NOT OSG_DISABLE_SOURCE_GROUPS)
1127     IF(APPLE AND IOS)
1128       ADD_LIBRARY(${PROJECT_NAME} STATIC
1129                   ${${PROJECT_NAME}_SRC}
1130                   ${${PROJECT_NAME}_HDR}
1131                   ${${PROJECT_NAME}_INL}
1132                   ${${PROJECT_NAME}_INS})
1133     ELSE()
1134       ADD_LIBRARY(${PROJECT_NAME} SHARED
1135                   ${${PROJECT_NAME}_SRC}
1136                   ${${PROJECT_NAME}_HDR}
1137                   ${${PROJECT_NAME}_INL}
1138                   ${${PROJECT_NAME}_INS})
1139     ENDIF()
1141     ADD_DEPENDENCIES(OSGAllLibs ${PROJECT_NAME})
1142     ADD_DEPENDENCIES(${OSG_MAIN_LIB_TARGET} ${PROJECT_NAME})
1144     IF(WIN32)
1145       IF(${OSG_MAIN_LIB_TARGET} MATCHES OSGAllCoreLibs)
1146         SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "OSGCoreLibraries")
1147       ELSEIF(${OSG_MAIN_LIB_TARGET} MATCHES OSGAllContribLibs)
1148         SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY FOLDER "OSGContribLibraries")
1149       ENDIF()
1150     ENDIF()
1152     INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
1154     SET(_OSG_DEBUG_POSTFIX "")
1156     IF(WIN32)
1157         SET(_OSG_DEBUG_POSTFIX DEBUG_POSTFIX "D")
1158     ENDIF(WIN32)
1160     IF(OSG_USE_OSG2_NAMESPACE)
1161       STRING(REGEX REPLACE "^OSG" "OSG2"
1162              PROJECT_NAME_VERSIONED
1163              ${PROJECT_NAME})
1164     ELSE()
1165       SET(PROJECT_NAME_VERSIONED ${PROJECT_NAME})
1166     ENDIF()
1168     SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
1169         DEFINE_SYMBOL ${PROJ_DEFINE}
1170         VERSION ${OSG_VERSION}
1171         SOVERSION ${OSG_VERSION}
1172         ${_OSG_DEBUG_POSTFIX}
1173         DEBUGOPT_POSTFIX "DO"
1174         RELEASENOOPT_POSTFIX "RN"
1175         OUTPUT_NAME ${PROJECT_NAME_VERSIONED})
1177     IF(${PROJECT_NAME}_SUFFIX)
1178       SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
1179                             SUFFIX ${${PROJECT_NAME}_SUFFIX})
1181     ENDIF(${PROJECT_NAME}_SUFFIX)
1183     # dependencies - OpenSG
1184     OSG_GET_ALL_DEP_OSG_LIB(
1185         "${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIST DEP_MISSING_LIST)
1187     # a lib with missing dependencies is fatal - it should not have made it here
1188     IF(DEP_MISSING_LIST)
1189         MESSAGE(FATAL_ERROR "Project ${PROJECT_NAME} has missing dependencies: ${DEP_MISSING_LIST}")
1190     ENDIF(DEP_MISSING_LIST)
1192     FOREACH(OSGDEP ${DEP_OSG_LIST})
1193         OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1194         INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1195     ENDFOREACH(OSGDEP)
1197     FOREACH(OSGDEP ${${PROJECT_NAME}_DEP_OSG_LIB})
1198         OSG_CHECKED_INCLUDE  ("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1200         SET(${_OSGDEP_IMPORTED} FALSE)
1202         IF(TARGET ${OSGDEP})
1203           GET_PROPERTY(_OSGDEP_IMPORTED TARGET ${OSGDEP} PROPERTY IMPORTED)
1204         ENDIF(TARGET ${OSGDEP})
1206         IF(NOT _OSGDEP_IMPORTED)
1207           ADD_DEPENDENCIES     (${PROJECT_NAME} ${OSGDEP})
1208         ENDIF(NOT _OSGDEP_IMPORTED)
1210         IF(NOT APPLE OR NOT IOS)
1211           TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OSGDEP})
1212         ENDIF()
1213     ENDFOREACH(OSGDEP)
1215     # dependencies - global
1216     FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
1217         OSG_MSG("  (global) - include dir ${INCDIR} = ${${INCDIR}}")
1218         INCLUDE_DIRECTORIES(${${INCDIR}})
1219     ENDFOREACH(INCDIR)
1221     FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
1222         OSG_MSG("  (system) - include dir ${INCDIR} = ${${INCDIR}}")
1223         INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1224     ENDFOREACH(INCDIR)
1226     FOREACH(LIB ${OSG_GLOBAL_DEP_LIBS})
1227         OSG_MSG("  (global) - library ${LIB} = ${${LIB}}")
1228         TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${LIB}})
1229     ENDFOREACH(LIB)
1231     IF(OSG_GLOBAL_DEP_DEFS)
1232         OSG_MSG("  (global) - definitions = ${OSG_GLOBAL_DEP_DEFS}")
1233         SET_PROPERTY(TARGET ${PROJECT_NAME}
1234             APPEND PROPERTY COMPILE_DEFINITIONS ${OSG_GLOBAL_DEP_DEFS})
1235     ENDIF(OSG_GLOBAL_DEP_DEFS)
1237     # dependencies - External
1238     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_INCDIR})
1239         OSG_MSG("  (external) - include dir ${INCDIR} = ${${INCDIR}}")
1240         INCLUDE_DIRECTORIES(${${INCDIR}})
1241     ENDFOREACH(INCDIR)
1243     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})
1244         OSG_MSG("  (external sys) - include dir ${INCDIR} = ${${INCDIR}}")
1245         IF(DEFINED ${INCDIR})
1246           INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1247         ELSE()
1248           INCLUDE_DIRECTORIES(SYSTEM ${INCDIR})
1249         ENDIF()
1250     ENDFOREACH(INCDIR)
1252     FOREACH(LIB ${${PROJECT_NAME}_DEP_LIB})
1253         OSG_MSG("  (external) - library ${LIB} = ${${LIB}}")
1254         IF(NOT APPLE OR NOT IOS)
1255           TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${LIB}})
1256         ENDIF()
1257     ENDFOREACH(LIB)
1259     IF(${PROJECT_NAME}_DEP_DEFS)
1260         OSG_MSG("  (external) - definitions = ${${PROJECT_NAME}_DEP_DEFS}")
1261         SET_PROPERTY(TARGET ${PROJECT_NAME}
1262             APPEND PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_DEP_DEFS})
1263     ENDIF(${PROJECT_NAME}_DEP_DEFS)
1265     IF(${PROJECT_NAME}_CXXFLAGS)
1266       SET_PROPERTY(TARGET ${PROJECT_NAME}
1267                     APPEND PROPERTY COMPILE_FLAGS ${${PROJECT_NAME}_CXXFLAGS})
1268     ENDIF(${PROJECT_NAME}_CXXFLAGS)
1270     IF(OSG_IGNORE_INSTALL_${PROJECT_NAME})
1271       RETURN()
1272     ENDIF()
1274     # install rules
1275     IF(WIN32)
1277         IF(OSG_INSTALL_SUBDIR)
1278             SET(_OSG_ISC "${OSG_INSTALL_SUBDIR}/")
1279         ELSE(OSG_INSTALL_SUBDIR)
1280             SET(_OSG_ISC "")
1281         ENDIF(OSG_INSTALL_SUBDIR)
1283         IF(OSG_USE_SEPARATE_LIBDIRS)
1284           SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC}rel)
1285           SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC}debug)
1286           SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC}relnoopt)
1287           SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC}debugopt)
1289           SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC}rel)
1290           SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC}debug)
1291           SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC}relnoopt)
1292           SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC}debugopt)
1293         ELSE(OSG_USE_SEPARATE_LIBDIRS)
1294           SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC})
1295           SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC})
1296           SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC})
1297           SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC})
1299           SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC})
1300           SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC})
1301           SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC})
1302           SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC})
1303         ENDIF(OSG_USE_SEPARATE_LIBDIRS)
1305         INSTALL(TARGETS ${PROJECT_NAME}
1306                 CONFIGURATIONS Release
1307                 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_REL})
1308 #                COMPONENT release_runtimes)
1310         INSTALL(TARGETS ${PROJECT_NAME}
1311                 CONFIGURATIONS Release
1313                 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_REL}
1314 #                COMPONENT release_libraries
1316                 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_REL})
1317 #                COMPONENT release_libraries)
1319         IF(NOT ${PROJECT_NAME}_NO_DBG_INSTALL)
1320           INSTALL(TARGETS ${PROJECT_NAME}
1321                   CONFIGURATIONS Debug
1322                   RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBG})
1323 #                  COMPONENT debug_runtimes)
1325           INSTALL(TARGETS ${PROJECT_NAME}
1326                   CONFIGURATIONS Debug
1328                   LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBG}
1329 #                  COMPONENT debug_libraries 
1331                   ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBG})
1332 #                  COMPONENT debug_libraries)
1333         ENDIF()
1335         INSTALL(TARGETS ${PROJECT_NAME}
1336                 CONFIGURATIONS ReleaseNoOpt
1337                 RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_RELNO})
1338 #                COMPONENT release_no_opt_runtimes)
1340         INSTALL(TARGETS ${PROJECT_NAME}
1341                 CONFIGURATIONS ReleaseNoOpt
1343                 LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_RELNO}
1344 #                COMPONENT release_no_opt_libraries
1346                 ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_RELNO})
1347 #                COMPONENT release_no_opt_libraries)
1349         IF(NOT ${PROJECT_NAME}_NO_DBG_INSTALL)
1350           INSTALL(TARGETS ${PROJECT_NAME}
1351                   CONFIGURATIONS DebugOpt
1352                   RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBGO})
1353 #                  COMPONENT debug_opt_runtimes)
1355           INSTALL(TARGETS ${PROJECT_NAME}
1356                   CONFIGURATIONS DebugOpt
1358                   LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBGO}
1359 #                  COMPONENT debug_opt_libraries
1361                   ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBGO})
1362 #                  COMPONENT debug_opt_libraries)
1363         ENDIF()
1366         IF(OSG_INSTALL_PDB_FILES)
1368           GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} Release_LOCATION)
1370           STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1372           INSTALL(FILES ${_TMPVAL1}
1373                   CONFIGURATIONS Release
1374                   DESTINATION ${_OSG_TARGET_BINDIR_REL})
1375 #                  COMPONENT release_program_db)
1378           GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} Debug_LOCATION)
1380           STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1382           INSTALL(FILES ${_TMPVAL1}
1383                   CONFIGURATIONS Debug
1384                   DESTINATION ${_OSG_TARGET_BINDIR_DBG})
1385 #                  COMPONENT debug_program_db)
1388           GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} ReleaseNoOpt_LOCATION)
1390           STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1392           INSTALL(FILES ${_TMPVAL1}
1393                   CONFIGURATIONS ReleaseNoOpt
1394                   DESTINATION ${_OSG_TARGET_BINDIR_RELNO})
1395 #                  COMPONENT release_no_opt_program_db)
1398           GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME} DebugOpt_LOCATION)
1400           STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
1402           INSTALL(FILES ${_TMPVAL1}
1403                   CONFIGURATIONS DebugOpt
1404                   DESTINATION ${_OSG_TARGET_BINDIR_DBGO})
1405 #                  COMPONENT debug_opt_program_db)
1407         ENDIF(OSG_INSTALL_PDB_FILES)
1409         IF(FALSE)
1410           INSTALL(TARGETS ${PROJECT_NAME}
1411                   CONFIGURATIONS MinSizeRel
1412                   RUNTIME DESTINATION lib/minsizerel)
1413 #                  COMPONENT release_minsize_runtimes)
1415           INSTALL(TARGETS ${PROJECT_NAME}
1416                   CONFIGURATIONS MinSizeRel
1417                   LIBRARY DESTINATION lib/minsizerel
1418 #                  COMPONENT release_minsize_libraries
1419                   ARCHIVE DESTINATION lib/minsizerel)
1420 #                  COMPONENT release_minsize_libraries)
1422           INSTALL(TARGETS ${PROJECT_NAME}
1423                   CONFIGURATIONS RelWithDebInfo
1424                   RUNTIME DESTINATION lib/relwithdbg)
1425 #                  COMPONENT release_with_debinfo_runtimes)
1427           INSTALL(TARGETS ${PROJECT_NAME}
1428                   CONFIGURATIONS RelWithDebInfo
1429                   LIBRARY DESTINATION lib/relwithdbg
1430 #                  COMPONENT release_with_debinfo_libraries
1431                   ARCHIVE DESTINATION lib/relwithdbg)
1432 #                  COMPONENT release_with_debinfo_libraries)
1433         ENDIF()
1434     ELSEIF(APPLE AND IOS)
1435         INSTALL(TARGETS ${PROJECT_NAME}
1436                 CONFIGURATIONS Release-iphoneos
1437                 DESTINATION lib/Release-iphoneos)
1438         INSTALL(TARGETS ${PROJECT_NAME}
1439                 CONFIGURATIONS Debug-iphoneos
1440                 DESTINATION lib/Debug-iphoneos)
1441         INSTALL(TARGETS ${PROJECT_NAME}
1442                 CONFIGURATIONS Release-iphonesimulator
1443                 DESTINATION lib/Release-iphonesimulator)
1444         INSTALL(TARGETS ${PROJECT_NAME}
1445                 CONFIGURATIONS Debug-iphonesimulator
1446                 DESTINATION lib/Debug-iphonesimulator)
1447     ELSEIF(XCODE_VERSION)
1448 #        INSTALL(TARGETS ${PROJECT_NAME}
1449 #                CONFIGURATIONS Release
1450 #                RUNTIME DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}
1451 #                COMPONENT release_runtimes)
1453         INSTALL(TARGETS ${PROJECT_NAME}
1454                 CONFIGURATIONS Release
1456                 LIBRARY DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}
1457 #                COMPONENT release_libraries
1459                 ARCHIVE DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX})
1460 #                COMPONENT release_libraries)
1462 #        INSTALL(TARGETS ${PROJECT_NAME}
1463 #                CONFIGURATIONS Debug
1464 #                RUNTIME DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}/debug
1465 #                COMPONENT debug_runtimes)
1467         INSTALL(TARGETS ${PROJECT_NAME}
1468                 CONFIGURATIONS Debug
1470                 LIBRARY DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}/debug
1471 #                COMPONENT debug_libraries
1473                 ARCHIVE DESTINATION lib${OSG_LIBDIR_BASE_SUFFIX}/debug)
1474 #                COMPONENT debug_libraries)
1475     ELSE(WIN32)
1476         INSTALL(TARGETS ${PROJECT_NAME}
1478                 RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX}
1479 #                COMPONENT libraries
1481                 LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX}
1482 #                COMPONENT libraries
1484                 ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX})
1485 #                COMPONENT libraries)
1486     ENDIF(WIN32)
1488     INSTALL(FILES ${${PROJECT_NAME}_HDR}
1489             DESTINATION include/OpenSG
1490             PERMISSIONS OWNER_WRITE OWNER_READ
1491                         GROUP_READ
1492                         WORLD_READ)
1493 #            COMPONENT code_headers)
1495     INSTALL(FILES ${${PROJECT_NAME}_INL}
1496             DESTINATION include/OpenSG
1497             PERMISSIONS OWNER_WRITE OWNER_READ
1498                         GROUP_READ
1499                         WORLD_READ)
1500 #            COMPONENT code_headers)
1502     INSTALL(FILES ${${PROJECT_NAME}_INS}
1503             DESTINATION include/OpenSG
1504             PERMISSIONS OWNER_WRITE OWNER_READ
1505                         GROUP_READ
1506                         WORLD_READ)
1507 #            COMPONENT code_headers)
1509     IF(NOT ${PROJECT_NAME}_NO_PYTHON)
1510       FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "libInfo[\"${PROJECT_NAME}\"] = [\n")
1511       FOREACH(OSG_DEP ${DEP_OSG_LIST})
1512         FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "\"${OSG_DEP}\",")
1513       ENDFOREACH()
1514       FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "]\n\n\n")
1515     ENDIF()
1517     FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "fullLibInfo[\"${PROJECT_NAME}\"] = [\n")
1518     FOREACH(OSG_DEP ${DEP_OSG_LIST})
1519       FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "\"${OSG_DEP}\",")
1520     ENDFOREACH()
1521     FILE(APPEND "${CMAKE_BINARY_DIR}/Python/Helper/libOrder.py" "]\n\n\n")
1523 ENDFUNCTION(OSG_SETUP_LIBRARY_BUILD)
1526 #############################################################################
1527 # perform default actions for pass OSGSETUPTEST
1529 FUNCTION(OSG_SETUP_TEST_BUILD)
1531     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPTEST")
1532         RETURN()
1533     ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPTEST")
1535     OSG_CHECKED_INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
1536     INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
1538     # dependencies - OpenSG
1539     OSG_GET_ALL_DEP_OSG_LIB(
1540         "${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIB DEP_MISSING_LIST)
1542     # if depencies are missing we skip the tests
1543     IF(DEP_MISSING_LIST)
1544         MESSAGE(STATUS "Tests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1545         RETURN()
1546     ENDIF(DEP_MISSING_LIST)
1548     FOREACH(OSGDEP ${DEP_OSG_LIB})
1549         OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1550         INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1551     ENDFOREACH(OSGDEP)
1553     # dependencies - test OpenSG
1554     OSG_GET_ALL_DEP_OSG_LIB(
1555         "${${PROJECT_NAME}_DEP_TEST_OSG_LIB}" DEP_TEST_OSG_LIB DEP_MISSING_LIST)
1557     # if depencies are missing we skip the tests
1558     IF(DEP_MISSING_LIST)
1559         MESSAGE(STATUS "Tests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1560         RETURN()
1561     ENDIF(DEP_MISSING_LIST)
1563     FOREACH(OSGTESTDEP ${DEP_TEST_OSG_LIB})
1564         OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGTESTDEP}.cmake")
1565         INCLUDE_DIRECTORIES(${${OSGTESTDEP}_INC})
1566     ENDFOREACH(OSGTESTDEP)
1568     # dependencies - global
1569     FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
1570         OSG_MSG("  (global) - include dir ${INCDIR} = ${${INCDIR}}")
1571         INCLUDE_DIRECTORIES(${${INCDIR}})
1572     ENDFOREACH(INCDIR)
1574     FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
1575         OSG_MSG("  (system) - include dir ${INCDIR} = ${${INCDIR}}")
1576         INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1577     ENDFOREACH(INCDIR)
1579     FOREACH(LIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
1580         OSG_MSG("  (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1581         LINK_DIRECTORIES(${${LIBDIR}})
1582     ENDFOREACH(LIBDIR)
1584     # dependencies - External
1585     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_INCDIR})
1586         OSG_MSG("  (external) - include dir ${INCDIR} = ${${INCDIR}}")
1587         INCLUDE_DIRECTORIES(${${INCDIR}})
1588     ENDFOREACH(INCDIR)
1590     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_SYS_INCDIR})
1591         OSG_MSG("  (external system) - include dir ${INCDIR} = ${${INCDIR}}")
1592         INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1593     ENDFOREACH(INCDIR)
1595     FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_LIBDIR})
1596         OSG_MSG("  (external) - library dir ${LIBDIR} = ${${LIBDIR}}")
1597         LINK_DIRECTORIES(${${LIBDIR}})
1598     ENDFOREACH(LIBDIR)
1600     # dependencies - test External
1601     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_TEST_INCDIR})
1602         OSG_MSG("  (test) - include dir ${INCDIR} = ${${INCDIR}}")
1603         INCLUDE_DIRECTORIES(${${INCDIR}})
1604     ENDFOREACH(INCDIR)
1606     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_SYS_TEST_INCDIR})
1607         OSG_MSG("  (test external sys) - include dir ${INCDIR} = ${${INCDIR}}")
1608         IF(DEFINED ${INCDIR})
1609           INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1610         ELSE()
1611           INCLUDE_DIRECTORIES(SYSTEM ${INCDIR})
1612         ENDIF()
1613     ENDFOREACH(INCDIR)
1615     FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_TEST_LIBDIR})
1616         OSG_MSG("  (test) - library dir ${LIBDIR} = ${${LIBDIR}}")
1617         LINK_DIRECTORIES(${${LIBDIR}})
1618     ENDFOREACH(LIBDIR)
1620     # build test programs
1621     FOREACH(EXE_SRC ${${PROJECT_NAME}_TEST_SRC} ${${PROJECT_NAME}_APP_SRC})
1622         GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1624         ADD_EXECUTABLE(${EXE} ${OSGEXCLUDE_TESTS} 
1625                               ${EXE_SRC} ${${PROJECT_NAME}_EXE_ADD_SRC} )
1627         IF(OSG_ALL_TEST_TARGET)
1628           ADD_DEPENDENCIES(${OSG_ALL_TEST_TARGET} ${EXE})
1629         ELSE()
1630           ADD_DEPENDENCIES(OSGAllTests ${EXE})
1631         ENDIF()
1633         FOREACH(OSGTESTDEP ${${PROJECT_NAME}_DEP_TEST_OSG_LIB})
1634             GET_PROPERTY(_OSGTESTDEP_IMPORTED TARGET ${OSGTESTDEP} PROPERTY IMPORTED)
1636             IF(NOT _OSGTESTDEP_IMPORTED)
1637               ADD_DEPENDENCIES(${EXE} ${OSGTESTDEP})
1638             ENDIF(NOT _OSGTESTDEP_IMPORTED)
1640             TARGET_LINK_LIBRARIES(${EXE} ${OSGTESTDEP})
1641         ENDFOREACH(OSGTESTDEP)
1643         FOREACH(OSGTESTDEP ${${PROJECT_NAME}_DEP_TEST_OSG_EEX_LIB})
1644             IF(TARGET ${OSGTESTDEP})
1645               GET_PROPERTY(_OSGTESTDEP_IMPORTED TARGET ${OSGTESTDEP} PROPERTY IMPORTED)
1647               IF(NOT _OSGTESTDEP_IMPORTED)
1648                 ADD_DEPENDENCIES(${EXE} ${OSGTESTDEP})
1649               ENDIF(NOT _OSGTESTDEP_IMPORTED)
1651               TARGET_LINK_LIBRARIES(${EXE} ${OSGTESTDEP})
1652             ENDIF(TARGET ${OSGTESTDEP})
1653         ENDFOREACH(OSGTESTDEP)
1655         FOREACH(LIB ${${PROJECT_NAME}_DEP_TEST_LIB})
1656             OSG_MSG("  (test) - library ${LIB} = ${${LIB}}")
1657             TARGET_LINK_LIBRARIES(${EXE} ${${LIB}})
1658         ENDFOREACH(LIB)
1660         IF(NOT ${PROJECT_NAME}_NO_LIB)
1661           TARGET_LINK_LIBRARIES(${EXE} ${PROJECT_NAME})
1662         ENDIF(NOT ${PROJECT_NAME}_NO_LIB)
1664         IF(${PROJECT_NAME}_DEP_DEFS)
1665             OSG_MSG("  (external) - definitions ${PROJECT_NAME}_DEP_DEFS = ${${PROJECT_NAME}_DEP_DEFS}")
1666             SET_PROPERTY(TARGET ${EXE} APPEND
1667                 PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_DEP_DEFS})
1668         ENDIF(${PROJECT_NAME}_DEP_DEFS)
1670         IF(${PROJECT_NAME}_CXXFLAGS)
1671           SET_PROPERTY(TARGET ${EXE}
1672                        APPEND PROPERTY COMPILE_FLAGS ${${PROJECT_NAME}_CXXFLAGS})
1673         ENDIF(${PROJECT_NAME}_CXXFLAGS)
1675         IF(${PROJECT_NAME}_DEP_TEST_DEFS)
1676             OSG_MSG("  (test) - definitions ${PROJECT_NAME}_DEP_TEST_DEFS = ${${PROJECT_NAME}_DEP_TEST_DEFS}")
1677             SET_PROPERTY(TARGET ${EXE} APPEND
1678                 PROPERTY COMPILE_DEFINITIONS ${${PROJECT_NAME}_DEP_TEST_DEFS})
1679         ENDIF(${PROJECT_NAME}_DEP_TEST_DEFS)
1681         IF(OSG_GLOBAL_DEP_DEFS)
1682           OSG_MSG("  (global) - definitions = ${OSG_GLOBAL_DEP_DEFS}")
1683           SET_PROPERTY(TARGET ${EXE}
1684                        APPEND PROPERTY COMPILE_DEFINITIONS ${OSG_GLOBAL_DEP_DEFS})
1685         ENDIF(OSG_GLOBAL_DEP_DEFS)
1687         IF(WIN32)
1688           IF(EXE_SRC MATCHES ^.*/app.*.cpp$)
1689             IF(OSG_APP_FOLDER)
1690               SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER ${OSG_APP_FOLDER})
1691             ELSE()
1692               SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER "Apps")
1693             ENDIF()
1694           ELSE()
1695             IF(OSG_TEST_FOLDER)
1696               SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER ${OSG_TEST_FOLDER})
1697             ELSE()
1698               SET_PROPERTY(TARGET ${EXE} PROPERTY FOLDER "Tests")
1699             ENDIF()
1700           ENDIF()
1701         ENDIF()
1702     ENDFOREACH(EXE_SRC)
1704     FOREACH(EXE_SRC ${${PROJECT_NAME}_APP_SRC})
1705       GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1706       IF(OSG_ALL_APPS_TARGET)
1707         ADD_DEPENDENCIES(${OSG_ALL_APPS_TARGET} ${EXE})
1708       ELSE()
1709         ADD_DEPENDENCIES(OSGAllApps ${EXE})
1710       ENDIF()
1711     ENDFOREACH()
1713     FOREACH(EXE_SRC ${${PROJECT_NAME}_APP_SRC})
1714       GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1716       SET_TARGET_PROPERTIES(${EXE} PROPERTIES EXCLUDE_FROM_ALL FALSE)
1717     ENDFOREACH()
1719     IF(OSG_INSTALL_APPS)
1720       IF(WIN32)
1721         IF(OSG_INSTALL_SUBDIR)
1722             SET(_OSG_ISC "${OSG_INSTALL_SUBDIR}/")
1723         ELSE(OSG_INSTALL_SUBDIR)
1724             SET(_OSG_ISC "")
1725         ENDIF(OSG_INSTALL_SUBDIR)
1727         IF(OSG_USE_SEPARATE_LIBDIRS)
1728           SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC}rel)
1729           SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC}debug)
1730           SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC}relnoopt)
1731           SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC}debugopt)
1733           SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC}rel)
1734           SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC}debug)
1735           SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC}relnoopt)
1736           SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC}debugopt)
1737         ELSE(OSG_USE_SEPARATE_LIBDIRS)
1738           SET(_OSG_TARGET_BINDIR_REL bin/${_OSG_ISC})
1739           SET(_OSG_TARGET_BINDIR_DBG bin/${_OSG_ISC})
1740           SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC})
1741           SET(_OSG_TARGET_BINDIR_DBGO bin/${_OSG_ISC})
1743           SET(_OSG_TARGET_LIBDIR_REL lib/${_OSG_ISC})
1744           SET(_OSG_TARGET_LIBDIR_DBG lib/${_OSG_ISC})
1745           SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC})
1746           SET(_OSG_TARGET_LIBDIR_DBGO lib/${_OSG_ISC})
1747         ENDIF(OSG_USE_SEPARATE_LIBDIRS)
1748       ENDIF(WIN32)
1750       FOREACH(EXE_SRC ${${PROJECT_NAME}_APP_SRC})
1751         GET_FILENAME_COMPONENT(EXE ${EXE_SRC} NAME_WE)
1753         SET_TARGET_PROPERTIES(${EXE} PROPERTIES EXCLUDE_FROM_ALL FALSE)
1755         IF(WIN32)
1757           INSTALL(TARGETS ${EXE}
1758                   CONFIGURATIONS Release
1759                   RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_REL})
1760 #                  COMPONENT release_binaries)
1761           INSTALL(TARGETS ${EXE}
1762                   CONFIGURATIONS Debug
1763                   RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBG})
1764 #                  COMPONENT debug_binaries)
1765           INSTALL(TARGETS ${EXE}
1766                   CONFIGURATIONS ReleaseNoOpt
1767                   RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_RELNO})
1768 #                  COMPONENT release_no_opt_binaries)
1769           INSTALL(TARGETS ${EXE}
1770                   CONFIGURATIONS DebugOpt
1771                   RUNTIME DESTINATION ${_OSG_TARGET_BINDIR_DBGO})
1772 #                  COMPONENT debug_opt_binaries)
1774         ELSE(WIN32)
1776           INSTALL(TARGETS ${EXE}
1777                   CONFIGURATIONS Release Debug DebugGV
1778                   RUNTIME DESTINATION bin/${OSG_LIBDIR_BUILD_TYPE_SUFFIX})
1779 #                  COMPONENT binaries)
1781         ENDIF(WIN32)
1782       ENDFOREACH()
1783     ENDIF(OSG_INSTALL_APPS)
1785 ENDFUNCTION(OSG_SETUP_TEST_BUILD)
1788 #############################################################################
1789 # perform default actions for pass OSGSETUPUNITTEST
1791 FUNCTION(OSG_SETUP_UNITTEST_BUILD)
1792     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPUNITTEST")
1793         RETURN()
1794     ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGSETUPUNITTEST")
1796     INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
1798     # are there unittests to build?
1799     IF(NOT ${PROJECT_NAME}_UNITTEST_SRC)
1800         RETURN()
1801     ENDIF(NOT ${PROJECT_NAME}_UNITTEST_SRC)
1803     INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
1804     INCLUDE_DIRECTORIES(${OSG_UNITTEST_INCLUDE_DIRS})
1806     # dependencies - OpenSG
1807     OSG_GET_ALL_DEP_OSG_LIB(
1808         "${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIB DEP_MISSING_LIST)
1810     # if depencies are missing we skip the unittests
1811     IF(DEP_MISSING_LIST)
1812         MESSAGE(STATUS "Unittests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1813         RETURN()
1814     ENDIF(DEP_MISSING_LIST)
1816     FOREACH(OSGDEP ${DEP_OSG_LIB})
1817         OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1818         INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1819     ENDFOREACH(OSGDEP)
1821     # dependencies - unittest OpenSG
1822     OSG_GET_ALL_DEP_OSG_LIB(
1823         "${${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB}" DEP_UNITTEST_OSG_LIB DEP_MISSING_LIST)
1825     # if depencies are missing we skip the unittests
1826     IF(DEP_MISSING_LIST)
1827         MESSAGE(STATUS "Unittests for project ${PROJECT_NAME} have missing dependencies: ${DEP_MISSING_LIST} - skipping")
1828         RETURN()
1829     ENDIF(DEP_MISSING_LIST)
1831     FOREACH(OSGDEP ${DEP_UNITTEST_OSG_LIB})
1832         OSG_CHECKED_INCLUDE("${CMAKE_BINARY_DIR}/${OSGDEP}.cmake")
1833         INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
1834     ENDFOREACH(OSGDEP)
1836     # dependencies global
1837     FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
1838         OSG_MSG("  (global) - include dir ${INCDIR} = ${${INCDIR}}")
1839         INCLUDE_DIRECTORIES(${${INCDIR}})
1840     ENDFOREACH(INCDIR)
1842     FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
1843         OSG_MSG("  (system) - include dir ${INCDIR} = ${${INCDIR}}")
1844         INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
1845     ENDFOREACH(INCDIR)
1847     FOREACH(LIBDIR ${OSG_GLOBAL_DEP_LIBDIR})
1848         OSG_MSG("  (global) - library dir ${LIBDIR} = ${${LIBDIR}}")
1849         LINK_DIRECTORIES(${${LIBDIR}})
1850     ENDFOREACH(LIBDIR)
1852     # dependencies - unittest External
1853     FOREACH(INCDIR ${${PROJECT_NAME}_DEP_UNITTEST_INCDIR})
1854         OSG_MSG("  (unittest) - include dir ${INCDIR} = ${${INCDIR}}")
1855         INCLUDE_DIRECTORIES(${${INCDIR}})
1856     ENDFOREACH(INCDIR)
1858     FOREACH(LIBDIR ${${PROJECT_NAME}_DEP_UNITTEST_LIBDIR})
1859         OSG_MSG("  (unittest) - library dir ${LIBDIR} = ${${LIBDIR}}")
1860         LINK_DIRECTORIES(${${LIBDIR}})
1861     ENDFOREACH(LIBDIR)
1863     LINK_DIRECTORIES(${OSG_UNITTEST_LIBRARY_DIRS})
1865     # add the unittest runner source
1866     LIST(APPEND ${PROJECT_NAME}_UNITTEST_SRC
1867         "${CMAKE_SOURCE_DIR}/Tools/unittest-cpp/UnitTestRunner.cpp")
1869     # build unittest executable
1870     ADD_EXECUTABLE("UnitTest${PROJECT_NAME}"
1871                    ${OSGEXCLUDE_UNITTESTS}
1872                    ${${PROJECT_NAME}_UNITTEST_SRC}
1873                    ${${PROJECT_NAME}_EXE_ADD_SRC})
1875     ADD_DEPENDENCIES(OSGAllUnitTests UnitTest${PROJECT_NAME})
1877     TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" "${OSG_UNITTEST_LIBRARY}")
1878     TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" ${PROJECT_NAME})
1880     FOREACH(OSGDEP ${${PROJECT_NAME}_DEP_UNITTEST_OSG_LIB})
1881         ADD_DEPENDENCIES("UnitTest${PROJECT_NAME}" ${OSGDEP})
1882         TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" ${OSGDEP})
1883     ENDFOREACH(OSGDEP)
1885     FOREACH(LIB ${${PROJECT_NAME}_DEP_UNITTEST_LIB})
1886         OSG_MSG("  (unittest) - library ${LIB} = ${${LIB}}")
1887         TARGET_LINK_LIBRARIES("UnitTest${PROJECT_NAME}" ${${LIB}})
1888     ENDFOREACH(LIB)
1890     #MESSAGE("--------- ADDING TEST --------- ${PROJECT_NAME}") # Trips up ccmake
1891     ADD_TEST("UnitTest${PROJECT_NAME}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/UnitTest${PROJECT_NAME}")
1893 ENDFUNCTION(OSG_SETUP_UNITTEST_BUILD)
1895 #############################################################################
1896 # perform default actions for pass OSGPYTHON
1898 FUNCTION(OSG_SETUP_PYTHON_BUILD)
1900   IF(${PROJECT_NAME}_NO_PYTHON OR NOT PYTHONLIBS_FOUND)
1901       RETURN()
1902   ENDIF(${PROJECT_NAME}_NO_PYTHON OR NOT PYTHONLIBS_FOUND)
1904   MESSAGE("  setup python for ${PROJECT_NAME} | ${OSG_CAN_REGEN_PYTHON_BINDINGS}")
1906   ##################################
1907   # Dependency includes
1908   ##################################
1910   OSG_GET_ALL_DEP_OSG_LIB("${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIST DEP_MISSING_LIST)
1912   # read file lists
1913   FOREACH(OSGDEP ${DEP_OSG_LIST})
1914     OSG_CHECKED_INCLUDE(${CMAKE_BINARY_DIR}/${OSGDEP}.cmake)
1915   ENDFOREACH()
1917   OSG_CHECKED_INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
1920   ##################################
1921   # Configure files
1922   ##################################
1924   FILE(MAKE_DIRECTORY ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR})
1926   SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
1928   IF(OSG_CAN_REGEN_PYTHON_BINDINGS)
1930     SET(_OSG_GEN_CONFIG_FILE_IN  "${OSG_PYTHON_SUPPORT_DIR}/osgGenBindings.py.in")
1931     SET(_OSG_GEN_CONFIG_FILE_OUT "${CMAKE_CURRENT_BINARY_DIR}/osgGenBindings_${PROJECT_NAME}.py")
1932     SET(_OSG_GEN_SETUP_FILE_IN   "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/osgSetupBindings_${PROJECT_NAME}.py.in")
1933     SET(_OSG_GEN_SETUP_FILE      "${CMAKE_CURRENT_BINARY_DIR}/osgSetupBindings_${PROJECT_NAME}.py")
1935     IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/__init__.py.in")
1936       SET(_OSG_GEN_INIT_FILE_IN  "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/__init__.py.in")
1937     ELSE()
1938       SET(_OSG_GEN_INIT_FILE_IN  "${OSG_PYTHON_SUPPORT_DIR}/__init__.py.in")
1939     ENDIF()
1941     IF(OSGBUILD_PYTHON_DUMP_DECLS)
1942       SET(OSG_DO_DUMP_PYTHON_DECLS True)
1943     ELSE()
1944       SET(OSG_DO_DUMP_PYTHON_DECLS False)
1945     ENDIF()
1947     CONFIGURE_FILE("${_OSG_GEN_CONFIG_FILE_IN}"
1948                    "${_OSG_GEN_CONFIG_FILE_OUT}")
1950     CONFIGURE_FILE("${_OSG_GEN_INIT_FILE_IN}"
1951                    "${_OSG_GEN_INIT_FILE_OUT}")
1953     ##################################
1954     # Setup File Base
1955     ##################################
1957     IF(EXISTS ${_OSG_GEN_SETUP_FILE_IN})
1958       CONFIGURE_FILE("${_OSG_GEN_SETUP_FILE_IN}"
1959                      "${_OSG_GEN_SETUP_FILE}")
1960       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "\n\n###############################\n")
1961       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "#auto setup for python bindings\n\n")
1962     ELSE()
1963       EXECUTE_PROCESS(
1964         COMMAND "${CMAKE_COMMAND}" -E copy_if_different
1965                 "${CMAKE_SOURCE_DIR}/Bindings/Python/osgDefaultGen.py"
1966                 "${_OSG_GEN_SETUP_FILE}")
1967     ENDIF()
1970     ##################################
1971     # Setup File ModuleHeader
1972     ##################################
1974     FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleHeaders = \\\n[\n")
1976     LIST(INSERT ${PROJECT_NAME}_PYTHON_BIND_HEADERS 0 "pypp_aliases.h")
1977     LIST(INSERT ${PROJECT_NAME}_PYTHON_BIND_HEADERS 0 "PreBoostPython.h")
1979     FOREACH(_OSG_HEADER ${${PROJECT_NAME}_PYTHON_BIND_HEADERS})
1980       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_OSG_HEADER}\",\n")
1981     ENDFOREACH()
1983     FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
1985     ##################################
1986     # Setup File ModuleFCs
1987     ##################################
1989     IF(${PROJECT_NAME}_PYTHON_BIND_FCS)
1990       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCs = \\\n[\n")
1992       FOREACH(_OSG_FC ${${PROJECT_NAME}_PYTHON_BIND_FCS})
1993         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_OSG_FC}\",\n")
1994       ENDFOREACH()
1996       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
1998       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCDFiles = None\n\n\n")
1999     ELSE()
2000       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCs = None\n\n\n")
2002       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleFCDFiles = \\\n[\n")
2004       FOREACH(_OSG_FC ${${PROJECT_NAME}_FCD})
2005         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_OSG_FC}\",\n")
2006       ENDFOREACH()
2008       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2009     ENDIF()
2011     ##################################
2012     # Setup File ModuleIncludes
2013     ##################################
2015     FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleIncludes = \\\n[\n")
2017     FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${PYTHON_INCLUDE_PATH}\",\n")
2018     FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${OSG_BOOST_INCDIRS}\",\n")
2020     IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper")
2021       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper\",\n")
2022     ENDIF()
2023     IF(EXISTS "${CMAKE_SOURCE_DIR}/Bindings/Python/Common")
2024       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${CMAKE_SOURCE_DIR}/Bindings/Python/Common\",\n")
2025     ENDIF()
2027     IF(${CMAKE_PROJECT_NAME} STREQUAL "OpenSG")
2028       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${CMAKE_BINARY_DIR}/Source/Base/Base\",\n")
2029 #      SET(OSG_PYTHON_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/Bindings/Python")
2030     ELSE()
2031       FOREACH(_INC_DIR ${OpenSG_INCLUDE_DIRS})
2032         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_INC_DIR}\",\n")
2033       ENDFOREACH()
2034 #      SET(OSG_PYTHON_SUPPORT_DIR "${OpenSG_DIR}/share/OpenSG/python")
2035     ENDIF()
2037     FOREACH(_OSG_INC ${${PROJECT_NAME}_INC})
2038       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_OSG_INC}\",\n")
2039     ENDFOREACH()
2041     FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2043     ##################################
2044     # Setup File ModuleDepIncludes
2045     ##################################
2047     IF(DEP_OSG_LIST)
2048       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepIncludes = \\\n[\n")
2050       FOREACH(OSGDEP ${DEP_OSG_LIST})
2051         FOREACH(_OSG_INC ${${OSGDEP}_INC})
2052           FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_OSG_INC}\",\n")
2053         ENDFOREACH()
2054       ENDFOREACH()
2056       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2057     ELSE()
2058       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepIncludes = None\n\n\n")
2059     ENDIF()
2061     ##################################
2062     # Setup File PythonModuleDeps
2063     ##################################
2065     IF(DEP_OSG_LIST)
2066       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepencies = \\\n[\n")
2068       FOREACH(OSGDEP ${DEP_OSG_LIST})
2069         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${OSG_PYTHON_${OSGDEP}_MODULE_DIR}/generated\",\n")
2070       ENDFOREACH()
2072       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2073     ELSE()
2074       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "moduleDepencies = None\n\n\n")
2075     ENDIF()
2077     ##################################
2078     # Setup File NativeWinDependents
2079     ##################################
2081     IF(${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT)
2082       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWinDependends = \\\n[\n")
2084       FOREACH(_OSG_NATIVEWIN_DEP ${${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT})
2085         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "  \"${_OSG_NATIVEWIN_DEP}\",\n")
2086       ENDFOREACH()
2088       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "]\n\n\n")
2089       IF(UNIX AND NOT APPLE)
2090         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWin = \"XWindow\"\n\n\n")
2091       ELSEIF(WIN32)
2092         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWin = \"WIN32Window\"\n\n\n")
2093       ELSEIF(UNIX AND APPLE)
2094         FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWin = \"CocoaWindow\"\n\n\n")
2095       ENDIF()
2096     ELSE()
2097       FILE(APPEND ${_OSG_GEN_SETUP_FILE} "nativeWinDependends = None\n\n\n")
2098     ENDIF()
2101     ##################################
2102     # Bindings Gen Target
2103     ##################################
2105     ADD_CUSTOM_TARGET(${PROJECT_NAME}PyGenOnly COMMAND ${PYTHON_EXECUTABLE} osgGenBindings_${PROJECT_NAME}.py)
2106     ADD_CUSTOM_TARGET(${PROJECT_NAME}PyGen     COMMAND ${PYTHON_EXECUTABLE} osgGenBindings_${PROJECT_NAME}.py)
2109     FOREACH(OSG_DEP ${${PROJECT_NAME}_DEP_OSG_LIB})
2110       ADD_DEPENDENCIES(${PROJECT_NAME}PyGen ${OSG_DEP}PyGen)
2111     ENDFOREACH()
2113     ADD_DEPENDENCIES(OSGPyGen   ${PROJECT_NAME}PyGen)
2115   ENDIF(OSG_CAN_REGEN_PYTHON_BINDINGS)
2117   ##################################
2118   # Bindings Lib Target
2119   ##################################
2121   IF(EXISTS "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated" AND NOT ${PROJECT_NAME}_PYTHON_GET_ONLY)
2122     FILE(GLOB   _OSG_BIND_SRC "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/*.pypp.cpp")
2123     LIST(APPEND _OSG_BIND_SRC "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${PROJECT_NAME}Py.main.cpp")
2125     FILE(GLOB   _OSG_BIND_SRC_TMP "${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper/*.cpp")
2127     LIST(APPEND _OSG_BIND_SRC ${_OSG_BIND_SRC_TMP})
2129     IF(${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT)
2131       FOREACH(_OSG_NATIVEWIN_DEP ${${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT})
2132         SET(_OSG_NATIVEWIN_DEP_IN      ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.cpp)
2133         SET(_OSG_NATIVEWIN_DEP_PATCHED ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.cpp.patched)
2134         SET(_OSG_NATIVEWIN_DEP_OUT     ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.patched.cpp)
2136         LIST(REMOVE_ITEM _OSG_BIND_SRC ${_OSG_NATIVEWIN_DEP_IN})
2137         LIST(REMOVE_ITEM _OSG_BIND_SRC ${_OSG_NATIVEWIN_DEP_OUT})
2139         IF(EXISTS ${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/generated/${_OSG_NATIVEWIN_DEP}Base.pypp.patched.cpp)
2140           LIST(APPEND      _OSG_BIND_SRC ${_OSG_NATIVEWIN_DEP_OUT})
2141         ENDIF()
2143       ENDFOREACH()
2144       
2145     ENDIF(${PROJECT_NAME}_PYTHON_NATIVEWINDOW_DEPENDENT)
2148     ADD_LIBRARY(${PROJECT_NAME}Py SHARED EXCLUDE_FROM_ALL ${_OSG_BIND_SRC})
2150     SET_TARGET_PROPERTIES(${PROJECT_NAME}Py PROPERTIES PREFIX "")
2152     IF(WIN32)
2154         SET_TARGET_PROPERTIES(${PROJECT_NAME}Py PROPERTIES
2155             VERSION              ${OSG_VERSION}
2156             SOVERSION            ${OSG_VERSION}
2157             SUFFIX               ".pyd")
2159         SET_PROPERTY(TARGET "${PROJECT_NAME}Py" PROPERTY FOLDER "PythonBindings")
2161     ENDIF(WIN32)
2164     INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
2165     INCLUDE_DIRECTORIES(${OSG_PYTHON_COMMON_INCDIR})
2166     INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/Bindings/Python/Wrapper)
2167     INCLUDE_DIRECTORIES(${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR})
2169     ADD_DEFINITIONS(-DBOOST_PYTHON_MAX_ARITY=21)
2171     FOREACH(OSGDEP ${DEP_OSG_LIST})
2172       INCLUDE_DIRECTORIES(${${OSGDEP}_INC})
2173     ENDFOREACH()
2175     INCLUDE_DIRECTORIES(${${PROJECT_NAME}_INC})
2176 #    INCLUDE_DIRECTORIES(${OSG_BOOST_INCDIRS})
2178     # dependencies global
2179     FOREACH(INCDIR ${OSG_GLOBAL_DEP_INCDIR})
2180         OSG_MSG("  (global) - include dir ${INCDIR} = ${${INCDIR}}")
2181         INCLUDE_DIRECTORIES(${${INCDIR}})
2182     ENDFOREACH(INCDIR)
2184     FOREACH(INCDIR ${OSG_SYSTEM_DEP_INCDIR})
2185         OSG_MSG("  (system) - include dir ${INCDIR} = ${${INCDIR}}")
2186         INCLUDE_DIRECTORIES(SYSTEM ${${INCDIR}})
2187     ENDFOREACH(INCDIR)
2189     TARGET_LINK_LIBRARIES(${PROJECT_NAME}Py ${PROJECT_NAME})
2190     TARGET_LINK_LIBRARIES(${PROJECT_NAME}Py ${OSG_BOOST_PYTHON_LIBS})
2191     TARGET_LINK_LIBRARIES(${PROJECT_NAME}Py ${PYTHON_LIBRARY})
2193     IF(WIN32) 
2195       IF(OSG_INSTALL_SUBDIR)
2196           SET(_OSG_ISC "${OSG_INSTALL_SUBDIR}/")
2197       ELSE(OSG_INSTALL_SUBDIR)
2198           SET(_OSG_ISC "")
2199       ENDIF(OSG_INSTALL_SUBDIR)
2201       SET(_OSG_TARGET_BINDIR_REL   bin/${_OSG_ISC}rel)
2202       SET(_OSG_TARGET_BINDIR_DBG   bin/${_OSG_ISC}debug)
2203       SET(_OSG_TARGET_BINDIR_RELNO bin/${_OSG_ISC}relnoopt)
2204       SET(_OSG_TARGET_BINDIR_DBGO  bin/${_OSG_ISC}debugopt)
2206       SET(_OSG_TARGET_LIBDIR_REL   lib/${_OSG_ISC}rel)
2207       SET(_OSG_TARGET_LIBDIR_DBG   lib/${_OSG_ISC}debug)
2208       SET(_OSG_TARGET_LIBDIR_RELNO lib/${_OSG_ISC}relnoopt)
2209       SET(_OSG_TARGET_LIBDIR_DBGO  lib/${_OSG_ISC}debugopt)
2211       SET(_OSG_TARGET_PYLIBDIR_REL   lib/python/${_OSG_ISC}rel/osg2/${PROJECT_NAME})
2212       SET(_OSG_TARGET_PYLIBDIR_DBG   lib/python/${_OSG_ISC}debug/osg2/${PROJECT_NAME})
2213       SET(_OSG_TARGET_PYLIBDIR_RELNO lib/python/${_OSG_ISC}relnoopt/osg2/${PROJECT_NAME})
2214       SET(_OSG_TARGET_PYLIBDIR_DBGO  lib/python/${_OSG_ISC}debugopt/osg2/${PROJECT_NAME})
2216       INSTALL(TARGETS ${PROJECT_NAME}Py
2217               CONFIGURATIONS Release
2218               RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_REL}
2219 #              COMPONENT release_runtimes
2220               OPTIONAL)
2222       INSTALL(TARGETS ${PROJECT_NAME}Py
2223               CONFIGURATIONS Release
2225               LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_REL}
2226 #              COMPONENT release_libraries
2227               OPTIONAL
2229               ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_REL}
2230 #              COMPONENT release_libraries
2231               OPTIONAL)
2233       INSTALL(TARGETS ${PROJECT_NAME}Py
2234               CONFIGURATIONS Debug
2235               RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_DBG}
2236 #              COMPONENT debug_runtimes
2237               OPTIONAL)
2239       INSTALL(TARGETS ${PROJECT_NAME}Py
2240               CONFIGURATIONS Debug
2242               LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBG}
2243 #              COMPONENT debug_libraries
2244               OPTIONAL
2246               ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBG}
2247 #              COMPONENT debug_libraries
2248               OPTIONAL)
2250       INSTALL(TARGETS ${PROJECT_NAME}Py
2251               CONFIGURATIONS ReleaseNoOpt
2252               RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_RELNO}
2253 #              COMPONENT release_no_opt_runtimes
2254               OPTIONAL)
2256       INSTALL(TARGETS ${PROJECT_NAME}Py
2257               CONFIGURATIONS ReleaseNoOpt
2259               LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_RELNO}
2260 #              COMPONENT release_no_opt_libraries
2261               OPTIONAL
2263               ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_RELNO}
2264 #              COMPONENT release_no_opt_libraries
2265               OPTIONAL)
2267       INSTALL(TARGETS ${PROJECT_NAME}Py
2268               CONFIGURATIONS DebugOpt
2269               RUNTIME DESTINATION ${_OSG_TARGET_PYLIBDIR_DBGO}
2270 #              COMPONENT debug_opt_runtimes
2271               OPTIONAL)
2273       INSTALL(TARGETS ${PROJECT_NAME}Py
2274               CONFIGURATIONS DebugOpt
2276               LIBRARY DESTINATION ${_OSG_TARGET_LIBDIR_DBGO}
2277 #              COMPONENT debug_opt_libraries
2278               OPTIONAL
2280               ARCHIVE DESTINATION ${_OSG_TARGET_LIBDIR_DBGO}
2281 #              COMPONENT debug_opt_libraries
2282               OPTIONAL)
2285       IF(OSG_INSTALL_PDB_FILES)
2287         GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py Release_LOCATION)
2289         STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2291         INSTALL(FILES ${_TMPVAL1}
2292                 CONFIGURATIONS Release
2293                 DESTINATION ${_OSG_TARGET_PYLIBDIR_REL}
2294 #                COMPONENT release_program_db
2295                 OPTIONAL)
2298         GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py Debug_LOCATION)
2300         STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2302         INSTALL(FILES ${_TMPVAL1}
2303                 CONFIGURATIONS Debug
2304                 DESTINATION ${_OSG_TARGET_PYLIBDIR_DBG}
2305 #                COMPONENT debug_program_db
2306                 OPTIONAL)
2309         GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py ReleaseNoOpt_LOCATION)
2311         STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2313         INSTALL(FILES ${_TMPVAL1}
2314                 CONFIGURATIONS ReleaseNoOpt
2315                 DESTINATION ${_OSG_TARGET_PYLIBDIR_RELNO}
2316 #                COMPONENT release_no_opt_program_db
2317                 OPTIONAL)
2320         GET_TARGET_PROPERTY(_TMPVAL ${PROJECT_NAME}Py DebugOpt_LOCATION)
2322         STRING(REPLACE "dll" "pdb" _TMPVAL1 ${_TMPVAL})
2324         INSTALL(FILES ${_TMPVAL1}
2325                 CONFIGURATIONS DebugOpt
2326                 DESTINATION ${_OSG_TARGET_PYLIBDIR_DBGO}
2327 #                COMPONENT debug_opt_program_db
2328                 OPTIONAL)
2330       ENDIF(OSG_INSTALL_PDB_FILES)
2332       SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2334       INSTALL(FILES          ${_OSG_GEN_INIT_FILE_OUT} 
2335               DESTINATION    ${_OSG_TARGET_PYLIBDIR_REL}
2336               CONFIGURATIONS Release
2337 #              COMPONENT      release_runtimes
2338               OPTIONAL)
2340       SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2341   
2342       INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
2343               DESTINATION ${_OSG_TARGET_PYLIBDIR_DBG}
2344               CONFIGURATIONS Debug
2345 #              COMPONENT      debug_runtimes
2346               OPTIONAL)
2348       SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2349   
2350       INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
2351               DESTINATION ${_OSG_TARGET_PYLIBDIR_DBGO}
2352               CONFIGURATIONS DebugOpt
2353 #              COMPONENT      debug_opt_runtimes
2354               OPTIONAL)
2356       SET(_OSG_GEN_INIT_FILE_OUT "${OSG_PYTHON_${PROJECT_NAME}_MODULE_DIR}/__init__.py")
2357   
2358       INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
2359               DESTINATION ${_OSG_TARGET_PYLIBDIR_RELNO}
2360               CONFIGURATIONS ReleaseNoOpt
2361 #              COMPONENT      release_no_opt_runtimes
2362               OPTIONAL)
2365     ELSE(WIN32)   
2366       GET_FILENAME_COMPONENT(_PY_VERSION_DIR ${PYTHON_INCLUDE_PATH} NAME)
2368       SET(_OSG_PY_INST_BASE 
2369           "lib${OSG_LIBDIR_BASE_SUFFIX}/${_PY_VERSION_DIR}/site-packages/${OSG_LIBDIR_BUILD_TYPE_SUFFIX}/osg2/${PROJECT_NAME}")
2371       INSTALL(TARGETS ${PROJECT_NAME}Py
2373               RUNTIME DESTINATION ${_OSG_PY_INST_BASE}
2374 #              COMPONENT libraries
2375               OPTIONAL
2377               LIBRARY DESTINATION ${_OSG_PY_INST_BASE}
2378 #              COMPONENT libraries
2379               OPTIONAL
2381               ARCHIVE DESTINATION ${_OSG_PY_INST_BASE}
2382 #              COMPONENT libraries
2384               OPTIONAL)
2386       INSTALL(FILES       ${_OSG_GEN_INIT_FILE_OUT} 
2387               DESTINATION ${_OSG_PY_INST_BASE}
2388 #              COMPONENT   libraries
2389               OPTIONAL)
2392 #      GET_PROPERTY(_OSG_CURR_SO_PATH TARGET ${PROJECT_NAME}Py PROPERTY LOCATION)
2394 #      GET_FILENAME_COMPONENT(_OSG_CURR_SO_NAME ${_OSG_CURR_SO_PATH} NAME)
2396       SET(_OSG_CURR_SO_NAME ${CMAKE_SHARED_LIBRARY_PREFX}${PROJECT_NAME}Py${CMAKE_SHARED_LIBRARY_SUFFIX})
2397       SET(_OSG_CURR_SO_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_OSG_CURR_SO_NAME})
2399       FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Python/lib/osg2/${PROJECT_NAME})
2401       OSG_SYMLINK_CHECKED(${_OSG_GEN_INIT_FILE_OUT}
2402                           ${CMAKE_BINARY_DIR}/Python/lib/osg2/${PROJECT_NAME}/__init__.py)
2403       OSG_SYMLINK_CHECKED(${_OSG_CURR_SO_PATH}
2404                           ${CMAKE_BINARY_DIR}/Python/lib/osg2/${PROJECT_NAME}/${_OSG_CURR_SO_NAME})
2406     ENDIF(WIN32)
2408     ADD_DEPENDENCIES(OSGPy      ${PROJECT_NAME}Py)
2409   ENDIF()
2411 ENDFUNCTION(OSG_SETUP_PYTHON_BUILD)
2413 #############################################################################
2414 # perform default actions for pass OSGDOXYDOC
2416 FUNCTION(OSG_SETUP_SEPARATE_LIBS_DOXYDOC)
2417     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGDOXYDOC")
2418         RETURN()
2419     ENDIF()
2421     IF(${PROJECT_NAME}_NO_DOC)
2422         RETURN()
2423     ENDIF(${PROJECT_NAME}_NO_DOC)
2425     # set up variables for the config file
2426     SET(OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE_IN "${CMAKE_SOURCE_DIR}/Doc/opensg-doxy.in")
2427     SET(OSG_${PROJECT_NAME}_DOC_DIRECTORY              "${OSG_DOXY_HTML_DIR}/${PROJECT_NAME}")
2428     SET(OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE    "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}-doxy")
2430     SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES"")
2431     SET(OSG_${PROJECT_NAME}_DOXY_TAGFILE     "${CMAKE_BINARY_DIR}/Doc/${PROJECT_NAME}_DOXYGEN_TAGS")
2432     SET(OSG_${PROJECT_NAME}_DEP_DOCS         "")
2434     # dependencies - OpenSG
2435     OSG_GET_ALL_DEP_OSG_LIB("${${PROJECT_NAME}_DEP_OSG_LIB}" DEP_OSG_LIST DEP_MISSING_LIST)
2437     FOREACH(OSGDEP ${DEP_OSG_LIST})
2438         SET(OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES "${OSG_${PROJECT_NAME}_DEP_DOXY_TAGFILES} ./${OSGDEP}_DOXYGEN_TAGS=../../${OSGDEP}/html")
2439         LIST(APPEND OSG_${PROJECT_NAME}_DEP_DOCS "${OSGDEP}Doc")
2440     ENDFOREACH()
2442     IF(EXISTS "${CMAKE_BINARY_DIR}/Doc/Include/${PROJECT_NAME}.include")
2443       SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/${PROJECT_NAME}.include")
2444     ENDIF()
2446     # write doxygen config file
2447     CONFIGURE_FILE("${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE_IN}"
2448                    "${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}")
2450     SET(OSG_DOC_BASIC_INPUT "${CMAKE_BINARY_DIR}/Doc/Include/OSGDummy.include")
2452     IF(DOXYGEN_EXECUTABLE)
2453         #ADD_CUSTOM_TARGET(DocUpload COMMAND unison -batch -ui text opensg_doc)
2454         #ADD_DEPENDENCIES(DocUpload Doc)
2456         SET(OSG_DOC_PIPES "")
2458         IF(OSG_DOXY_STDOUT_LOG)
2459           SET(OSG_DOC_PIPES > ${OSG_DOXY_STDOUT_LOG}.${PROJECT_NAME})
2460         ENDIF(OSG_DOXY_STDOUT_LOG)
2462         ADD_CUSTOM_TARGET(${PROJECT_NAME}DocOnly
2463             VERBATIM
2464             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES}
2465             WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Doc")
2467         ADD_CUSTOM_TARGET(${PROJECT_NAME}Doc
2468             VERBATIM
2469             COMMAND ${DOXYGEN_EXECUTABLE} ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} ${OSG_DOC_PIPES}
2470             WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Doc")
2472         FOREACH(OSGDEPDOC ${OSG_${PROJECT_NAME}_DEP_DOCS})
2473             ADD_DEPENDENCIES(${PROJECT_NAME}Doc ${OSGDEPDOC})
2474         ENDFOREACH()
2476         ADD_DEPENDENCIES(Doc ${PROJECT_NAME}Doc)
2477     ENDIF()
2479     INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
2483 #    FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2484 #        "#############################################################################\n")
2486 #    IF(${PROJECT_NAME}_DOXY_EXTRA_INC)
2487 #        FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2488 #            "# doc input files for ${PROJECT_NAME}\n\n")
2490 #        FOREACH(DOXYFILE ${${PROJECT_NAME}_DOXY_EXTRA_INC})
2491 #            FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2492 #                "INPUT += ${DOXYFILE}\n")
2493 #        ENDFOREACH()
2495 #        FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} "\n")
2496 #    ENDIF()
2498     FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2499         "# source code input files for ${PROJECT_NAME}\n\n")
2501     FOREACH(INCDIR ${${PROJECT_NAME}_INC})
2502         FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE}
2503             "INPUT += ${INCDIR}\n")
2504     ENDFOREACH()
2506     FILE(APPEND ${OSG_${PROJECT_NAME}_DOXY_CONFIGURATION_FILE} "\n")
2508 ENDFUNCTION(OSG_SETUP_SEPARATE_LIBS_DOXYDOC)
2510 #############################################################################
2511 # perform default actions for pass OSGDOXYDOC
2513 FUNCTION(OSG_SETUP_DOXYDOC)
2514     IF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGDOXYDOC")
2515         RETURN()
2516     ENDIF(NOT ${OSG_CMAKE_PASS} STREQUAL "OSGDOXYDOC")
2518     IF(${PROJECT_NAME}_NO_DOC)
2519         RETURN()
2520     ENDIF(${PROJECT_NAME}_NO_DOC)
2523     INCLUDE(${${PROJECT_NAME}_BUILD_FILE})
2525     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
2526         "#############################################################################\n"
2527         )
2528     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
2529         "# doc input files for ${PROJECT_NAME}\n\n"
2530         )
2532     FOREACH(INCDIR ${${PROJECT_NAME}_INC})
2533         FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE}
2534             "INPUT += ${INCDIR}\n")
2535     ENDFOREACH(INCDIR)
2537     FILE(APPEND ${OSG_DOXY_CONFIGURATION_FILE} "\n")
2539 ENDFUNCTION(OSG_SETUP_DOXYDOC)
2541 #############################################################################
2542 # perform default actions for build passes
2544 FUNCTION(OSG_SETUP_PROJECT PROJ_DEFINE)
2546     FOREACH(_OSG_${PROJECT_NAME}_EXT_DIR ${${PROJECT_NAME}_EXT_DIRS})
2547       OSG_ADD_DIRECTORY(${_OSG_${PROJECT_NAME}_EXT_DIR})
2548     ENDFOREACH(_OSG_${PROJECT_NAME}_EXT_DIR ${${PROJECT_NAME}_EXT_DIRS})
2550     IF(OSG_CMAKE_PASS STREQUAL "OSGSETUP")
2551         OSG_SETUP_LIBRARY_BUILD(${PROJ_DEFINE})
2553     ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGSETUPTEST")
2554         OSG_SETUP_TEST_BUILD()
2556     ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGSETUPUNITTEST")
2557         OSG_SETUP_UNITTEST_BUILD()
2559     ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGDOXYDOC" AND NOT OSG_DOXY_INPUTS)
2560         IF(OSG_GENERATE_SEPARATE_LIB_DOC)
2561             OSG_SETUP_SEPARATE_LIBS_DOXYDOC()
2562         ELSE()
2563             OSG_SETUP_DOXYDOC()
2564         ENDIF()
2566     ELSEIF(OSG_CMAKE_PASS STREQUAL "OSGPYTHON")
2567       OSG_SETUP_PYTHON_BUILD()
2569     ENDIF(OSG_CMAKE_PASS STREQUAL "OSGSETUP")
2571 ENDFUNCTION(OSG_SETUP_PROJECT)
2573 #############################################################################
2574 # setup import targets so the debug/debugopt build type works correctly
2576 FUNCTION(OSG_SETUP_IMPORT_LIB_WINDOWS NEW_LIB)
2578   IF(${NEW_LIB}_RELEASE)
2579       GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_RELEASE} PATH)
2580   ENDIF(${NEW_LIB}_RELEASE)
2582   IF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2583       GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_DEBUG} PATH)
2584   ENDIF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2586   IF(NOT ${NEW_LIB}_DEBUG)
2587     MESSAGE("  warning not debug lib for ${NEW_LIB}")
2589     IF(NOT EXISTS "${CMAKE_BINARY_DIR}/osgDummyLinkLib.c")
2590       FILE(WRITE "${CMAKE_BINARY_DIR}/osgDummyLinkLib.c" "")
2591     ENDIF()
2593     IF(NOT TARGET OSGDummyLinkLib)
2594       ADD_LIBRARY(OSGDummyLinkLib STATIC osgDummyLinkLib.c)
2595     ENDIF()
2597     SET_TARGET_PROPERTIES(OSG_${NEW_LIB}_TARGET PROPERTIES
2598                           IMPORTED_IMPLIB_RELEASE ${${NEW_LIB}_RELEASE}
2599                           IMPORTED_LOCATION_RELEASE ${OSG_TMP_LIB_DIR}
2600                           IMPORTED_IMPLIB_RELEASENOOPT ${${NEW_LIB}_RELEASE}
2601                           IMPORTED_LOCATION_RELEASENOOPT ${OSG_TMP_LIB_DIR}
2602                           IMPORTED_IMPLIB_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug/OSGDummyLinkLib.lib"
2603                           IMPORTED_LOCATION_DEBUG "${CMAKE_BINARY_DIR}/bin/Debug"
2604                           IMPORTED_IMPLIB_DEBUGOPT "${CMAKE_BINARY_DIR}/bin/Debug/OSGDummyLinkLib.lib"
2605                           IMPORTED_LOCATION_DEBUGOPT "${CMAKE_BINARY_DIR}/bin/Debug")
2607       ADD_DEPENDENCIES(OSG_${NEW_LIB}_TARGET OSGDummyLinkLib)
2609   ELSE()
2611     SET_TARGET_PROPERTIES(OSG_${NEW_LIB}_TARGET PROPERTIES
2612                           IMPORTED_IMPLIB_RELEASE ${${NEW_LIB}_RELEASE}
2613                           IMPORTED_LOCATION_RELEASE ${OSG_TMP_LIB_DIR}
2614                           IMPORTED_IMPLIB_RELEASENOOPT ${${NEW_LIB}_RELEASE}
2615                           IMPORTED_LOCATION_RELEASENOOPT ${OSG_TMP_LIB_DIR}
2616                           IMPORTED_IMPLIB_DEBUG ${${NEW_LIB}_DEBUG}
2617                           IMPORTED_LOCATION_DEBUG ${OSG_TMP_LIB_DIR}
2618                           IMPORTED_IMPLIB_DEBUGOPT ${${NEW_LIB}_DEBUG}
2619                           IMPORTED_LOCATION_DEBUGOPT ${OSG_TMP_LIB_DIR})
2620   ENDIF()
2623 ENDFUNCTION(OSG_SETUP_IMPORT_LIB_WINDOWS)
2625 FUNCTION(OSG_SETUP_IMPORT_LIB_UNIX NEW_LIB)
2627   IF(${NEW_LIB}_RELEASE)
2628       GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_RELEASE} PATH)
2629   ENDIF(${NEW_LIB}_RELEASE)
2631   IF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2632       GET_FILENAME_COMPONENT(OSG_TMP_LIB_DIR ${${NEW_LIB}_DEBUG} PATH)
2633   ENDIF(NOT OSG_TMP_LIB_DIR AND ${NEW_LIB}_DEBUG)
2635   IF(${NEW_LIB}_RELEASE AND NOT ${NEW_LIB}_DEBUG)
2636     SET(${NEW_LIB}_DEBUG ${${NEW_LIB}_RELEASE} CACHE FILEPATH "" FORCE)
2637   ENDIF(${NEW_LIB}_RELEASE AND NOT ${NEW_LIB}_DEBUG)
2639   IF(NOT ${NEW_LIB}_RELEASE AND ${NEW_LIB}_DEBUG)
2640     SET(${NEW_LIB}_RELEASE ${${NEW_LIB}_DEBUG} CACHE FILEPATH "" FORCE)
2641   ENDIF(NOT ${NEW_LIB}_RELEASE AND ${NEW_LIB}_DEBUG)
2643   SET_TARGET_PROPERTIES(OSG_${NEW_LIB}_TARGET PROPERTIES
2644                         IMPORTED_LOCATION ${${NEW_LIB}_RELEASE}
2645                         IMPORTED_LOCATION_DEBUG ${${NEW_LIB}_DEBUG}
2646                         IMPORTED_LOCATION_DEBUGGV ${${NEW_LIB}_DEBUG})
2648 ENDFUNCTION(OSG_SETUP_IMPORT_LIB_UNIX)
2650 MACRO(OSG_ADD_IMPORT_LIB LIB_LIST NEW_LIB)
2652   IF(NOT TARGET OSG_${NEW_LIB}_TARGET)
2653     ADD_LIBRARY(OSG_${NEW_LIB}_TARGET SHARED IMPORTED)
2655     IF(WIN32)
2656       OSG_SETUP_IMPORT_LIB_WINDOWS(${NEW_LIB})
2657     ELSE(WIN32)
2658       OSG_SETUP_IMPORT_LIB_UNIX(${NEW_LIB})
2660       OSG_ADD_OPT(${NEW_LIB}_RELEASE)
2661       OSG_ADD_OPT(${NEW_LIB}_DEBUG)
2662       OSG_ADD_OPT(OSG_${NEW_LIB}_TARGET)
2663     ENDIF(WIN32)
2665     LIST(APPEND ${LIB_LIST} OSG_${NEW_LIB}_TARGET)
2666   ENDIF()
2668 ENDMACRO(OSG_ADD_IMPORT_LIB)
2670 ##########################################################################
2671 # write settings so different variants can be build with the same settings
2673 MACRO(OSG_OPTION NAME DESC VALUE)
2674     LIST(APPEND OSG_OPTION_LIST ${NAME})
2675     OSG_MSG("adding option ${NAME} = ${VALUE}")
2677     OPTION(${NAME} "${DESC}" ${VALUE})
2678 ENDMACRO(OSG_OPTION)
2680 MACRO(OSG_SET_CACHE NAME VALUE TYPE DESC)
2681     LIST(APPEND OSG_OPTION_LIST ${NAME})
2683     SET(${NAME} ${VALUE} CACHE ${TYPE} "${DESC}")
2684 ENDMACRO(OSG_SET_CACHE)
2686 MACRO(OSG_SET NAME VALUE)
2687     LIST(APPEND OSG_OPTION_LIST ${NAME})
2689     SET(${NAME} ${VALUE})
2690 ENDMACRO(OSG_SET)
2692 MACRO(OSG_ADD_OPT NAME)
2693     LIST(APPEND OSG_OPTION_LIST ${NAME})
2694 ENDMACRO(OSG_ADD_OPT)
2696 MACRO(OSG_ADD_OPT_SUBDIR NAME)
2697     LIST(APPEND OSG_OPTION_LIST ${NAME})
2699     SET(OSG_OPTION_LIST "${OSG_OPTION_LIST}" PARENT_SCOPE)
2700 ENDMACRO(OSG_ADD_OPT_SUBDIR)
2702 MACRO(OSG_FIND_PACKAGE NAME)
2703     FIND_PACKAGE(${NAME})
2705     IF(${NAME}_FOUND)
2706         OSG_ADD_OPT(${NAME}_LIBRARIES)
2707         OSG_ADD_OPT(${NAME}_INCLUDE_DIR)
2708     ENDIF(${NAME}_FOUND)
2710     OSG_ADD_OPT(${NAME}_FOUND)
2711 ENDMACRO(OSG_FIND_PACKAGE)
2713 MACRO(OSG_FIND_PACKAGE_QUIET NAME)
2714     FIND_PACKAGE(${NAME} QUIET)
2716     IF(${NAME}_FOUND)
2717         OSG_ADD_OPT(${NAME}_LIBRARIES)
2718         OSG_ADD_OPT(${NAME}_INCLUDE_DIR)
2719     ENDIF(${NAME}_FOUND)
2721     OSG_ADD_OPT(${NAME}_FOUND)
2722 ENDMACRO(OSG_FIND_PACKAGE_QUIET)
2724 MACRO(OSG_BOOST_DEP_SETUP)
2725     SET(Boost_USE_MULTITHREADED ON )
2726     SET(Boost_USE_STATIC_LIBS   OFF)
2728     SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
2729     SET(Boost_ADDITIONAL_VERSIONS "1.54.0" 
2730                                   "1.54"
2731                                   "1.53.0" 
2732                                   "1.53"
2733                                   "1.52.0" 
2734                                   "1.52"
2735                                   "1.51.0" 
2736                                   "1.51"
2737                                   "1.50.0"
2738                                   "1.50"
2739                                   "1.49.0" 
2740                                   "1.49"
2741                                   "1.48.0"
2742                                   "1.48"
2743                                   "1.47.0"
2744                                   "1.47.0")
2746     FIND_PACKAGE(Boost COMPONENTS filesystem system)
2748     IF(Boost_FOUND)
2750         IF(PYTHON_INCLUDE_PATH AND PYTHON_LIBRARY)
2751           FIND_PACKAGE(Boost COMPONENTS python)
2752         ENDIF(PYTHON_INCLUDE_PATH AND PYTHON_LIBRARY)
2754         # We ignore if boost python fails, we catch that somewhere else
2755         # so if we get here Boost_FOUND was true in the first place
2756         SET(Boost_FOUND TRUE)
2758         # Hide settings
2759         SET(Boost_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY}
2760                                      CACHE INTERNAL "")
2761         SET(Boost_FILESYSTEM_LIBRARY_DEBUG ${Boost_FILESYSTEM_LIBRARY_DEBUG}
2762                                            CACHE INTERNAL "")
2763         SET(Boost_FILESYSTEM_LIBRARY_RELEASE
2764            ${Boost_FILESYSTEM_LIBRARY_RELEASE}
2765            CACHE INTERNAL "")
2767         SET(Boost_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY}
2768                                CACHE INTERNAL "")
2769         SET(Boost_SYSTEM_LIBRARY_DEBUG ${Boost_SYSTEM_LIBRARY_DEBUG}
2770                                        CACHE INTERNAL "")
2771         SET(Boost_SYSTEM_LIBRARY_RELEASE
2772            ${Boost_SYSTEM_LIBRARY_RELEASE}
2773            CACHE INTERNAL "")
2775         SET(Boost_PYTHON_LIBRARY ${Boost_PYTHON_LIBRARY}
2776                                      CACHE INTERNAL "")
2777         SET(Boost_PYTHON_LIBRARY_DEBUG ${Boost_PYTHON_LIBRARY_DEBUG}
2778                                            CACHE INTERNAL "")
2779         SET(Boost_PYTHON_LIBRARY_RELEASE
2780            ${Boost_PYTHON_LIBRARY_RELEASE}
2781            CACHE INTERNAL "")
2784         SET(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIR}
2785                               CACHE INTERNAL "")
2787         SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS}
2788                                CACHE INTERNAL "")
2790         SET(Boost_USE_MULTITHREADED ${Boost_USE_MULTI_THREADED}
2791                                     CACHE INTERNAL "")
2794         INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR} )
2796         IF(UNIX)
2797             LINK_DIRECTORIES   (${Boost_LIBRARY_DIRS})
2798         ENDIF(UNIX)
2800         IF(NOT Boost_USE_STATIC_LIBS)
2801           ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK)
2802         ENDIF(NOT Boost_USE_STATIC_LIBS)
2804         IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR
2805            CMAKE_BUILD_TYPE STREQUAL "DebugOpt")
2807           SET(OSG_BOOST_LIBS ${Boost_FILESYSTEM_LIBRARY_DEBUG} 
2808                              ${Boost_SYSTEM_LIBRARY_DEBUG})
2810           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_DEBUG})
2812         ELSE()
2814           SET(OSG_BOOST_LIBS ${Boost_FILESYSTEM_LIBRARY_RELEASE} 
2815                              ${Boost_SYSTEM_LIBRARY_RELEASE})
2817           SET(OSG_BOOST_PYTHON_LIBS ${Boost_PYTHON_LIBRARY_RELEASE})
2819         ENDIF()
2821         SET(OSG_BOOST_INCDIRS ${Boost_INCLUDE_DIR})
2823     ENDIF(Boost_FOUND)
2824 ENDMACRO(OSG_BOOST_DEP_SETUP)
2826 FUNCTION(OSG_WRITE_SETTINGS FILENAME)
2827     FILE(WRITE ${FILENAME}
2828             "# CMake.settings -- auto generated\n\n")
2830     FOREACH(OSG_OPT ${OSG_OPTION_LIST})
2831       IF(TARGET ${OSG_OPT})
2832         STRING(REPLACE _TARGET "" _OSG_OPT_BASE ${OSG_OPT})
2833         STRING(REPLACE OSG_ "" _OSG_OPT_OSGBASE ${_OSG_OPT_BASE})
2835         IF(NOT ${_OSG_OPT_OSGBASE}_DEBUG)
2836           SET(${_OSG_OPT_OSGBASE}_DEBUG ${OSG_${_OSG_OPT_OSGBASE}_DEBUG})
2837         ENDIF()
2838         IF(NOT ${_OSG_OPT_OSGBASE}_RELEASE)
2839           SET(${_OSG_OPT_OSGBASE}_RELEASE ${OSG_${_OSG_OPT_OSGBASE}_RELEASE})
2840         ENDIF()
2842         FILE(APPEND ${FILENAME}
2843           "ADD_LIBRARY(${_OSG_OPT_BASE}_TARGET SHARED IMPORTED)\n"
2844           "SET_TARGET_PROPERTIES(${_OSG_OPT_BASE}_TARGET PROPERTIES\n"
2845           "                      IMPORTED_LOCATION ${${_OSG_OPT_OSGBASE}_RELEASE}\n"
2846           "                      IMPORTED_LOCATION_DEBUG ${${_OSG_OPT_OSGBASE}_DEBUG}\n"
2847           "                      IMPORTED_LOCATION_DEBUGGV ${${_OSG_OPT_OSGBASE}_DEBUG})\n")
2848       ELSE()
2849         FILE(APPEND ${FILENAME}
2850              "SET(${OSG_OPT} \"${${OSG_OPT}}\" CACHE INTERNAL \"\")\n")
2851       ENDIF()
2852     ENDFOREACH(OSG_OPT ${OSG_OPTION_LIST})
2854 ENDFUNCTION(OSG_WRITE_SETTINGS FILENAME)
2856 FUNCTION(OSG_WRITE_OSGBUILD FILENAME)
2858   FILE(WRITE ${FILENAME}
2859             "# CMake.build.settings -- auto generated\n\n")
2861   GET_CMAKE_PROPERTY(_variableNames VARIABLES)
2863   FOREACH(_variableName ${_variableNames})
2864     IF(_variableName MATCHES "^OSGBUILD_")
2865       FILE(APPEND ${FILENAME}
2866            "SET(${_variableName} ${${_variableName}} CACHE BOOL \"\" FORCE)\n")
2867     ENDIF()
2868   ENDFOREACH()
2869 ENDFUNCTION(OSG_WRITE_OSGBUILD FILENAME)
2871 FUNCTION(OSG_WRITE_OSGGLOBALSETUP FILENAME)
2873   FILE(WRITE ${FILENAME}
2874             "# CMake.build.settings -- auto generated\n\n")
2876       FILE(APPEND ${FILENAME}
2877            "SET(OSG_ENABLE_C++11 ${OSG_ENABLE_C++11} CACHE BOOL \"\" FORCE)\n")
2878       FILE(APPEND ${FILENAME}
2879            "SET(CUDA_PROPAGATE_HOST_FLAGS ${CUDA_PROPAGATE_HOST_FLAGS} CACHE BOOL \"\" FORCE)\n")
2880 ENDFUNCTION(OSG_WRITE_OSGGLOBALSETUP FILENAME)
2882 FUNCTION(CHECK_BUILD_DIR)
2883   IF("${${CMAKE_PROJECT_NAME}_SOURCE_DIR}"  STREQUAL "${${CMAKE_PROJECT_NAME}_BINARY_DIR}")
2884     MESSAGE(FATAL_ERROR "${CMAKE_PROJECT_NAME} requires an out of source Build. \n"
2885                         "Please create a separate binary directory and run "
2886                         "CMake there.")
2887   ENDIF("${${CMAKE_PROJECT_NAME}_SOURCE_DIR}"  STREQUAL "${${CMAKE_PROJECT_NAME}_BINARY_DIR}")
2888 ENDFUNCTION(CHECK_BUILD_DIR)
2890 MACRO(OSG_CHECK_INSTALL)
2892 MESSAGE(STATUS  "process ignore install ${OSG_IGNORE_INSTALL}")
2894   IF(OSG_IGNORE_INSTALL)
2895     FOREACH(OSG_IGNORE_PRJ ${OSG_IGNORE_INSTALL})
2896       SET(OSG_IGNORE_INSTALL_${OSG_IGNORE_PRJ} TRUE)
2897     ENDFOREACH()
2898   ENDIF(OSG_IGNORE_INSTALL)
2899 ENDMACRO(OSG_CHECK_INSTALL)
2901 ##########################################################################
2902 # Add Tutorial builds as tests
2904 FUNCTION(OSG_ADD_TUTORIAL_TESTS TUTORIALS_NAME TUTORIAL_SOURCE_DIR)
2905     IF(NOT OSGBUILD_UNITTESTS)
2906         RETURN()
2907     ENDIF()
2909     FILE(GLOB TUTORIAL_SOURCES "${TUTORIAL_SOURCE_DIR}/[0-9][0-9]*.cpp")
2911     FOREACH(TUTORIAL ${TUTORIAL_SOURCES})
2912         #Get the path to the tutorial executable
2913         STRING(LENGTH ${TUTORIAL} SOURCE_PATH_LENGTH)
2914         MATH(EXPR SOURCE_PATH_LENGTH '${SOURCE_PATH_LENGTH}-4')
2915         STRING(SUBSTRING ${TUTORIAL} 0 ${SOURCE_PATH_LENGTH} TUTORIAL_EXE_PATH )
2916         SET(TUTORIAL_EXE_PATH "${TUTORIAL_EXE_PATH}${CMAKE_EXECUTABLE_SUFFIX}")
2918         #Extract a short name for the tutorial test
2919         STRING(REGEX MATCH "([0-9][0-9].*)[.]cpp" TUTORIAL_NAME ${TUTORIAL})
2920         SET(TUTORIAL_NAME ${CMAKE_MATCH_1})
2922         #Add a test to see if the tutorial exists
2923         ADD_TEST(NAME "${TUTORIALS_NAME}-${TUTORIAL_NAME}"
2924                  COMMAND test -e ${TUTORIAL_EXE_PATH})
2925     ENDFOREACH()
2926 ENDFUNCTION()