1 ## =======================================================================
2 ## == Force c++11 language version ==
3 ## == NOTE: It seems that by default on Visual Studio Compiler supports ==
4 ## == c++11, so it only need to be tested on other OS. ==
5 ## =======================================================================
8 INCLUDE(CheckCXXCompilerFlag)
9 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
10 IF(COMPILER_SUPPORTS_CXX11)
11 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
12 ELSE(COMPILER_SUPPORTS_CXX11)
13 CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
14 IF(COMPILER_SUPPORTS_CXX0X)
15 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
16 ELSE(COMPILER_SUPPORTS_CXX0X)
19 "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support."
21 ENDIF(COMPILER_SUPPORTS_CXX0X)
22 ENDIF(COMPILER_SUPPORTS_CXX11)
25 ## ===================================================
26 ## == Prepare header generator to build shared libs ==
27 ## ===================================================
29 INCLUDE(GenerateExportHeader)
31 ## ==================================================
32 ## == Do not allow to build inside the source tree ==
33 ## ==================================================
35 IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
36 MESSAGE(FATAL_ERROR "Building in the source tree is not allowed.")
37 ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
39 ## =================================================
40 ## == Where to put targets (executables and libs) ==
41 ## =================================================
43 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
44 SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
46 CMAKE_BACKWARDS_COMPATIBILITY
47 EXECUTABLE_OUTPUT_PATH