2 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
4 PROJECT(OpenSGExamplesTutorial)
6 IF(EXISTS "${${PROJECT_NAME}_SOURCE_DIR}/../../CMake")
7 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${${PROJECT_NAME}_SOURCE_DIR}/../../CMake")
10 IF(EXISTS "${${PROJECT_NAME}_SOURCE_DIR}/../../cmake")
11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${${PROJECT_NAME}_SOURCE_DIR}/../../cmake")
14 # show build command lines
15 SET(CMAKE_VERBOSE_MAKEFILE ON)
17 OPTION(OSG_USE_OSGSUPPORT_LIBS "" OFF)
19 IF(NOT OSG_SUPPORT_ROOT)
20 SET(OSG_SUPPORT_ROOT "" CACHE PATH "")
24 SET(OpenSG_DIR "" CACHE PATH "")
27 #############################################################################
30 FILE(GLOB SRCFILES "*.cpp")
32 #############################################################################
35 SET(OSG_COMPONENTS OSGBase
55 FIND_PACKAGE(OpenGL REQUIRED)
56 LIST(APPEND DEP_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
57 LIST(APPEND DEP_LIBRARIES ${OPENGL_LIBRARIES})
62 FIND_PACKAGE(GLUT REQUIRED)
63 LIST(APPEND DEP_INCLUDE_DIRS ${GLUT_INCLUDE_DIR})
64 LIST(APPEND DEP_LIBRARIES ${GLUT_LIBRARIES})
67 #### Collada (optional, required if OSGFileIO is used
68 #### and was built with collada support)
73 LIST(APPEND DEP_INCLUDE_DIRS ${COLLADA_INCLUDE_DIRS})
74 LIST(APPEND DEP_LIBRARY_DIRS ${COLLADA_LIBRARY_DIRS})
80 SET(Boost_USE_MULTITHREAD ON)
81 SET(Boost_STATIC_LIBS OFF)
83 SET(Boost_COMPONENTS system ${Boost_COMPONENTS})
86 LIST(APPEND Boost_COMPONENTS filesystem)
89 FIND_PACKAGE(Boost COMPONENTS ${Boost_COMPONENTS} REQUIRED)
92 LIST(APPEND DEP_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
93 LIST(APPEND DEP_LIBRARY_DIRS ${Boost_LIBRARY_DIRS})
94 LIST(APPEND DEP_LIBRARIES ${Boost_LIBRARIES})
100 FIND_PACKAGE(OpenSG REQUIRED COMPONENTS ${OSG_COMPONENTS})
102 #############################################################################
105 FOREACH(SRC ${SRCFILES})
107 GET_FILENAME_COMPONENT(EXE ${SRC} NAME_WE)
109 INCLUDE_DIRECTORIES(${OpenSG_INCLUDE_DIRS})
110 INCLUDE_DIRECTORIES(${DEP_INCLUDE_DIRS})
112 LINK_DIRECTORIES(${OpenSG_LIBRARY_DIRS})
113 LINK_DIRECTORIES(${DEP_LIBRARY_DIRS})
115 ADD_EXECUTABLE(${EXE} ${SRC})
117 TARGET_LINK_LIBRARIES(${EXE} ${OpenSG_LIBRARIES})
118 TARGET_LINK_LIBRARIES(${EXE} ${DEP_LIBRARIES})