CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(PolyVox) SET(POLYVOX_VERSION_MAJOR "0") SET(POLYVOX_VERSION_MINOR "1") SET(POLYVOX_VERSION_PATCH "0") SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}") OPTION(ENABLE_CPP0X "Does the compiler support C++0x" ON) #Disable with -DENABLE_CPP0X=OFF or in the GUI IF(ENABLE_CPP0X) INCLUDE(CheckCXXCompilerFlag) IF(CMAKE_COMPILER_IS_GNUCXX) #Maybe "OR MINGW" CHECK_CXX_COMPILER_FLAG(-std=c++0x COMPILER_CPP0X_SUPPORTED) #Check if flag is supported... IF(COMPILER_CPP0X_SUPPORTED) ADD_DEFINITIONS(-DC_PLUS_PLUS_ZERO_X_SUPPORTED -std=c++0x) #...if so, add it... ELSE(COMPILER_CPP0X_SUPPORTED) SET(ENABLE_CPP0X OFF) #...if not, disable C++0x mode. MESSAGE(STATUS "Your version of GCC does not support the -std=c++0x flag. C++0x mode is disabled.") ENDIF(COMPILER_CPP0X_SUPPORTED) ELSEIF(MSYS) #ADD_DEFINITIONS(-DC_PLUS_PLUS_ZERO_X_SUPPORTED) ENDIF() ENDIF() FIND_PACKAGE(Doxygen) IF(WIN32) #These are used on Windows to ensure that the .exe's and .dll get placed in the ame directory, so that we can run them. #Note they are actually deprecated in favour of 'RUNTIME_OUTPUT_DIRECTORY' et al, but these replacements apparently don't #work on Windows. See http://www.vtk.org/Bug/bug_view_advanced_page.php?bug_id=8366 SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) #These are what _should_ be set. If we require 2.8 then test it with these. #SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) #SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) ENDIF(WIN32) ADD_SUBDIRECTORY(library) OPTION(ENABLE_EXAMPLES "Should the examples be built" ON) IF(ENABLE_EXAMPLES) ADD_SUBDIRECTORY(examples/OpenGL) ADD_DEPENDENCIES(OpenGLExample PolyVoxCore PolyVoxUtil) ENDIF(ENABLE_EXAMPLES) INCLUDE(Packaging.cmake) INCLUDE(CTest) MARK_AS_ADVANCED(FORCE DART_TESTING_TIMEOUT) #This is only needed to hide the variable in the GUI (CMake bug) IF(BUILD_TESTING) ADD_SUBDIRECTORY(tests) ENDIF(BUILD_TESTING) # Option summary MESSAGE(STATUS "") MESSAGE(STATUS "Summary") MESSAGE(STATUS "-------") MESSAGE(STATUS "C++0x mode: " ${ENABLE_CPP0X}) MESSAGE(STATUS "Build examples: " ${ENABLE_EXAMPLES}) MESSAGE(STATUS "Build tests: " ${BUILD_TESTING}) MESSAGE(STATUS "API Docs available: " ${DOXYGEN_FOUND}) MESSAGE(STATUS "")