mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Improvements to CMake buildsystem (#563)
* Move enable_testing() into proper place * 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. * Externalize googletest project Externalize gtest to avoid installation, fixes #539. * Remove defined cmake_policies CMP0012 - OLD marked as deprecated for >=cmake-3.1 and will be removed CMP0015 - does not affect to build process CMP0042 - already NEW for >=cmake-3.1 Fixes #505 * Fix compiling in Windows MSVC
This commit is contained in:

committed by
Jesse Beder

parent
1698b47b65
commit
3e33bb3166
@@ -1,26 +1,11 @@
|
||||
###
|
||||
### 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)
|
||||
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012
|
||||
if(POLICY CMP0012)
|
||||
cmake_policy(SET CMP0012 OLD)
|
||||
endif()
|
||||
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015
|
||||
if(POLICY CMP0015)
|
||||
cmake_policy(SET CMP0015 OLD)
|
||||
endif()
|
||||
# see https://cmake.org/cmake/help/latest/policy/CMP0042.html
|
||||
if(POLICY CMP0042)
|
||||
# Enable MACOSX_RPATH by default.
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
|
||||
###
|
||||
### Project settings
|
||||
###
|
||||
@@ -31,8 +16,6 @@ set(YAML_CPP_VERSION_MINOR "6")
|
||||
set(YAML_CPP_VERSION_PATCH "2")
|
||||
set(YAML_CPP_VERSION "${YAML_CPP_VERSION_MAJOR}.${YAML_CPP_VERSION_MINOR}.${YAML_CPP_VERSION_PATCH}")
|
||||
|
||||
enable_testing()
|
||||
|
||||
|
||||
###
|
||||
### Project options
|
||||
@@ -48,6 +31,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)
|
||||
|
||||
@@ -188,7 +175,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)
|
||||
@@ -360,6 +347,7 @@ endif()
|
||||
### Extras
|
||||
###
|
||||
if(YAML_CPP_BUILD_TESTS)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
if(YAML_CPP_BUILD_TOOLS)
|
||||
|
Reference in New Issue
Block a user