mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-08 12:21:17 +00:00
Set C++ standard options in CMake per-target instead of globally (#735)
Setting CMAKE_CXX_STANDARD and CMAKE_CXX_STANDARD_REQUIRED directly is problematic when including yaml-cpp as a subproject. The proper way is to set these per-target.
This commit is contained in:

committed by
Jesse Beder

parent
90350662c9
commit
d638508d33
@@ -26,10 +26,6 @@ option(YAML_CPP_INSTALL "Enable generation of install target" 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)
|
||||
|
||||
@@ -261,6 +257,11 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||
PRIVATE $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/src>)
|
||||
endif()
|
||||
|
||||
set_target_properties(yaml-cpp PROPERTIES
|
||||
CXX_STANDARD 11
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
)
|
||||
|
||||
set_target_properties(yaml-cpp PROPERTIES
|
||||
COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
||||
)
|
||||
|
Reference in New Issue
Block a user