Allow yaml-cpp to be installed from another project (#1007)
Changes YAML_CPP_INSTALL from a cmake_dependent_option to an option. Fixes #756, #847, and #1011.
This commit is contained in:
parent
0e6e98e8fb
commit
7d06655611
@ -9,6 +9,11 @@ endif()
|
||||
|
||||
project(YAML_CPP VERSION 0.7.0 LANGUAGES CXX)
|
||||
|
||||
set(YAML_CPP_MAIN_PROJECT OFF)
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(YAML_CPP_MAIN_PROJECT ON)
|
||||
endif()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CMakeDependentOption)
|
||||
include(CheckCXXCompilerFlag)
|
||||
@ -17,6 +22,7 @@ include(GNUInstallDirs)
|
||||
option(YAML_CPP_BUILD_CONTRIB "Enable yaml-cpp contrib in library" ON)
|
||||
option(YAML_CPP_BUILD_TOOLS "Enable parse tools" ON)
|
||||
option(YAML_BUILD_SHARED_LIBS "Build yaml-cpp shared library" ${BUILD_SHARED_LIBS})
|
||||
option(YAML_CPP_INSTALL "Enable generation of yaml-cpp install targets" ${YAML_CPP_MAIN_PROJECT})
|
||||
option(YAML_CPP_FORMAT_SOURCE "Format source" ON)
|
||||
|
||||
if (YAML_CPP_BUILD_TESTS)
|
||||
@ -30,9 +36,6 @@ endif()
|
||||
cmake_dependent_option(YAML_CPP_BUILD_TESTS
|
||||
"Enable yaml-cpp tests" ON
|
||||
"BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
cmake_dependent_option(YAML_CPP_INSTALL
|
||||
"Enable generation of yaml-cpp install targets" ON
|
||||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
cmake_dependent_option(YAML_MSVC_SHARED_RT
|
||||
"MSVC: Build yaml-cpp with shared runtime libs (/MD)" ON
|
||||
"CMAKE_SYSTEM_NAME MATCHES Windows" OFF)
|
||||
|
Loading…
Reference in New Issue
Block a user