fixed: auto_ptr -> unique_ptr
[opensg.git] / CMake / OSGCommonSupportConfig.cmake
blob9301e7e52c8d65c1ea94bd810cc4d57da0d0acab
2 MACRO(OSG_COMMONSUPP_SETUP)
4   ##############
5   # Compiler
6   ##############
8   SET(BUILD_SHARED_LIBS ON CACHE INTERNAL 
9                         "Set to ON to build dynamic libraries" FORCE)
10   SET(BUILD_STATIC_LIBS ON CACHE INTERNAL 
11                         "Set to ON to build static libraries"  FORCE)
13   IF(WIN32)
14     OPTION(OSG_DISABLE_MICROSOFT_SECURE_CXXX "" OFF)
16     IF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
17       OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" ON)
18     ELSE(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
19       OPTION(OSG_DISABLE_MS_ITERATOR_DEBUGGING "" OFF)
20     ENDIF(OSG_DISABLE_MICROSOFT_SECURE_CXXX)
21   ENDIF(WIN32)
23   SET(OSG_PLATFORM_64 0)
24   SET(OSG_PLATFORM_32 0)
25   SET(OSG_LIBDIR_SUFFIX "")
27   SET(OSG_ENABLE_C++11 "" ON)
28   SET(OSG_ENABLE_SSE2  "" ON)
30   IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
31     SET(OSG_PLATFORM_64 1)
32     SET(OSG_LIBDIR_SUFFIX "64")
34     IF(NOT WIN32)
35       SET(OSG_LIBDIR_BASE_SUFFIX "64")
36     ENDIF(NOT WIN32)
37   ELSE()
38     SET(OSG_PLATFORM_32 1)
39   ENDIF()
41   IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
42     SET(OSG_LIBDIR_SUFFIX "${OSG_LIBDIR_SUFFIX}/debug")
43     SET(OSG_LIBDIR_BUILD_TYPE_SUFFIX "debug")
44   ENDIF()
46   IF(${CMAKE_CXX_PLATFORM_ID} STREQUAL "Linux")
47     SET(LINUX 1)
48   ENDIF()
50   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" 
51                                 CACHE STRING "OpenSGSupport Build Types" FORCE )
53   IF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
54     SET(CMAKE_BUILD_TYPE Debug CACHE STRING
55         "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
56         FORCE)
57   ENDIF(NOT WIN32 AND NOT CMAKE_BUILD_TYPE)
60   IF(NOT OSG_COMPILER_DEFAULTS)
61     INCLUDE(OSGSetupCompiler)
62      SET( OSG_COMPILER_DEFAULTS 1 CACHE INTERNAL "Defaults written" FORCE )
63   ENDIF(NOT OSG_COMPILER_DEFAULTS)
65   INCLUDE(OSGUpdateCompiler)
66   INCLUDE(OSGBuildFunctions)
67   INCLUDE(OSGConfigurePackages)
69   SET(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "" FORCE)
71   IF(NOT WIN32)
72     SET(OSG_SUPPORT_INC_SUBDIR "/OpenSG")
73   ENDIF()
75   FIND_PACKAGE(OpenGL)
77   SET(Boost_NO_BOOST_CMAKE TRUE CACHE INTERNAL "" FORCE)
78   OSG_CONFIGURE_BOOST()
80   ADD_CUSTOM_TARGET(ALL_CUDA_BUILD)
81   ADD_CUSTOM_TARGET(ALL_STANDARD_BUILD)
83   IF(OSGGlutSrcDir AND OSGFreeGlutSrcDir)
84     MESSAGE(FATAL_ERROR "choose either glut or freeglut")
85   ENDIF(OSGGlutSrcDir AND OSGFreeGlutSrcDir)
87 ENDMACRO()
89 MACRO(OSG_COMMON_SUPP_WRITE_CONFIG _OSG_CFG_FILENAME)
91   SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" 
92                                 CACHE STRING "OpenSGSupport Build Types" FORCE )
94   FILE(WRITE  "${CMAKE_BINARY_DIR}/${_OSG_CFG_FILENAME}" 
95               "SET(OSG_SUPPORT_DISABLE_MICROSOFT_SECURE_CXXX "
96               "${OSG_DISABLE_MICROSOFT_SECURE_CXXX} CACHE INTERNAL \"\")\n\n")
98   FILE(APPEND  "${CMAKE_BINARY_DIR}/${_OSG_CFG_FILENAME}" 
99                "SET(OSG_SUPPORT_DISABLE_MS_ITERATOR_DEBUGGING "
100                "${OSG_DISABLE_MS_ITERATOR_DEBUGGING} CACHE INTERNAL \"\")\n\n")
102   INSTALL(FILES ${CMAKE_BINARY_DIR}/${_OSG_CFG_FILENAME}
103           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}
104           PERMISSIONS OWNER_WRITE OWNER_READ
105                       GROUP_READ
106                       WORLD_READ)
108 ENDMACRO()
110 MACRO(OSG_COMMON_SUPP_EXTERNAL)
112   SET(OSG_EXTRA_EXTERNAL_SUPPORT "" CACHE STRING 
113       "Extra modules that OpenSG will try to compile.")
115   FOREACH(EXTERNAL ${OSG_EXTRA_EXTERNAL_SUPPORT})
117     IF(NOT DEFINED OSG_${EXTERNAL}_SUPP_SOURCE_DIR)
118       SET(OSG_${EXTERNAL}_SUPP_SOURCE_DIR 
119             "OSG_${EXTERNAL}_SUPP_SOURCE_DIR-NOTFOUND" CACHE PATH "")
120     ENDIF()
121     
122     IF(OSG_${EXTERNAL}_SUPP_SOURCE_DIR AND
123        EXISTS ${OSG_${EXTERNAL}_SUPP_SOURCE_DIR}/CMakeLists.txt)
124        ADD_SUBDIRECTORY(${OSG_${EXTERNAL}_SUPP_SOURCE_DIR} External/${EXTERNAL})
125     ENDIF()
127   ENDFOREACH(EXTERNAL)
129 ENDMACRO()