mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Use target-based include_directories to enable modern CMake usage (#583)
This commit is contained in:

committed by
Jesse Beder

parent
124ae47600
commit
ab5f9259a4
@@ -116,9 +116,10 @@ if(VERBOSE)
|
|||||||
message(STATUS "contrib_private_headers: ${contrib_private_headers}")
|
message(STATUS "contrib_private_headers: ${contrib_private_headers}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(${YAML_CPP_SOURCE_DIR}/src)
|
if (CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||||
include_directories(${YAML_CPP_SOURCE_DIR}/include)
|
include_directories(${YAML_CPP_SOURCE_DIR}/src)
|
||||||
|
include_directories(${YAML_CPP_SOURCE_DIR}/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -275,6 +276,14 @@ set(_INSTALL_DESTINATIONS
|
|||||||
### Library
|
### Library
|
||||||
###
|
###
|
||||||
add_library(yaml-cpp ${library_sources})
|
add_library(yaml-cpp ${library_sources})
|
||||||
|
|
||||||
|
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
|
||||||
|
target_include_directories(yaml-cpp
|
||||||
|
PUBLIC $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/include>
|
||||||
|
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_ROOT_DIR}>
|
||||||
|
PRIVATE $<BUILD_INTERFACE:${YAML_CPP_SOURCE_DIR}/src>)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(yaml-cpp PROPERTIES
|
set_target_properties(yaml-cpp PROPERTIES
|
||||||
COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}"
|
||||||
)
|
)
|
||||||
|
@@ -30,6 +30,7 @@ file(GLOB test_new_api_sources new-api/[a-z]*.cpp)
|
|||||||
list(APPEND test_sources ${test_new_api_sources})
|
list(APPEND test_sources ${test_new_api_sources})
|
||||||
add_sources(${test_sources} ${test_headers})
|
add_sources(${test_sources} ${test_headers})
|
||||||
|
|
||||||
|
include_directories(${YAML_CPP_SOURCE_DIR}/src)
|
||||||
include_directories(${YAML_CPP_SOURCE_DIR}/test)
|
include_directories(${YAML_CPP_SOURCE_DIR}/test)
|
||||||
|
|
||||||
add_executable(run-tests
|
add_executable(run-tests
|
||||||
|
Reference in New Issue
Block a user