Added CMake's checks for C++11 standards
Raised minimal version of CMake to 3.1, since on old systems there no decent compilers that supports c++11. Closes #377.
This commit is contained in:
parent
2aa08cf7ad
commit
4b1054e1aa
@ -1,9 +1,8 @@
|
||||
###
|
||||
### CMake settings
|
||||
###
|
||||
## Due to Mac OSX we need to keep compatibility with CMake 2.6
|
||||
# see http://www.cmake.org/Wiki/CMake_Policies
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012
|
||||
if(POLICY CMP0012)
|
||||
cmake_policy(SET CMP0012 OLD)
|
||||
@ -46,6 +45,10 @@ option(YAML_CPP_BUILD_CONTRIB "Enable contrib stuff in library" ON)
|
||||
# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:add_library
|
||||
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
||||
|
||||
# Set minimum C++ to 2011 standards
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# --> Apple
|
||||
option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
|
||||
|
||||
@ -185,7 +188,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
|
||||
set(GCC_EXTRA_OPTIONS "${GCC_EXTRA_OPTIONS} ${FLAG_TESTED}")
|
||||
endif()
|
||||
#
|
||||
set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long -std=c++11 ${yaml_cxx_flags}")
|
||||
set(yaml_cxx_flags "-Wall ${GCC_EXTRA_OPTIONS} -pedantic -Wno-long-long ${yaml_cxx_flags}")
|
||||
|
||||
### Make specific
|
||||
if(${CMAKE_BUILD_TOOL} MATCHES make OR ${CMAKE_BUILD_TOOL} MATCHES gmake)
|
||||
|
||||
@ -15,12 +15,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(yaml_test_flags "${yaml_test_flags} -Wno-c99-extensions")
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(yaml_test_flags "${yaml_test_flags} -std=gnu++11")
|
||||
else()
|
||||
set(yaml_test_flags "${yaml_test_flags} -std=c++11")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(GLOB test_headers [a-z_]*.h)
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
add_sources(parse.cpp)
|
||||
add_executable(parse parse.cpp)
|
||||
target_link_libraries(parse yaml-cpp)
|
||||
set_target_properties(parse PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
|
||||
add_sources(sandbox.cpp)
|
||||
add_executable(sandbox sandbox.cpp)
|
||||
target_link_libraries(sandbox yaml-cpp)
|
||||
set_target_properties(sandbox PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
|
||||
add_sources(read.cpp)
|
||||
add_executable(read read.cpp)
|
||||
target_link_libraries(read yaml-cpp)
|
||||
set_target_properties(read PROPERTIES COMPILE_FLAGS "-std=c++11")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user