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