-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix installing CMake exported targets #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ endif() | |
|
|
||
| include(CheckCXXCompilerFlag) | ||
|
|
||
|
|
||
| ### | ||
| ### Project settings | ||
| ### | ||
|
|
@@ -115,10 +114,7 @@ if(VERBOSE) | |
| message(STATUS "contrib_private_headers: ${contrib_private_headers}") | ||
| endif() | ||
|
|
||
| include_directories(${YAML_CPP_SOURCE_DIR}/src) | ||
| include_directories(${YAML_CPP_SOURCE_DIR}/include) | ||
|
|
||
|
|
||
| include_directories(include) | ||
|
|
||
| ### | ||
| ### General compilation settings | ||
|
|
@@ -267,12 +263,12 @@ endif() | |
| set(INCLUDE_INSTALL_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/include) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should change also. |
||
|
|
||
| set(INCLUDE_INSTALL_DIR ${INCLUDE_INSTALL_ROOT_DIR}/yaml-cpp) | ||
| set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${_library_dir}${LIB_SUFFIX}") | ||
| set(LIB_INSTALL_DIR "${_library_dir}${LIB_SUFFIX}") | ||
|
|
||
| set(_INSTALL_DESTINATIONS | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin | ||
| RUNTIME DESTINATION bin | ||
| LIBRARY DESTINATION ${LIB_INSTALL_DIR} | ||
| ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" | ||
| ARCHIVE DESTINATION "lib${LIB_SUFFIX}" | ||
| ) | ||
|
|
||
|
|
||
|
|
@@ -281,7 +277,7 @@ set(_INSTALL_DESTINATIONS | |
| ### | ||
| add_library(yaml-cpp ${library_sources}) | ||
| set_target_properties(yaml-cpp PROPERTIES | ||
| COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}" | ||
| COMPILE_FLAGS "${yaml_c_flags} ${yaml_cxx_flags}" | ||
| ) | ||
|
|
||
| set_target_properties(yaml-cpp PROPERTIES | ||
|
|
@@ -331,7 +327,7 @@ else() | |
| set(INSTALL_CMAKE_DIR ${LIB_INSTALL_DIR}/cmake/yaml-cpp) | ||
| endif() | ||
|
|
||
| file(RELATIVE_PATH REL_INCLUDE_DIR "${INSTALL_CMAKE_DIR}" "${INCLUDE_INSTALL_ROOT_DIR}") | ||
| file(RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}" "${INCLUDE_INSTALL_ROOT_DIR}") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will expand to |
||
| set(CONFIG_INCLUDE_DIRS "\${YAML_CPP_CMAKE_DIR}/${REL_INCLUDE_DIR}") | ||
| configure_file(${CMAKE_CURRENT_SOURCE_DIR}/yaml-cpp-config.cmake.in | ||
| "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/yaml-cpp-config.cmake" @ONLY) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,9 +6,15 @@ | |
| # Compute paths | ||
| get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
| set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@") | ||
| get_filename_component(YAML_CPP_INCLUDE_DIR "${YAML_CPP_INCLUDE_DIR}" REALPATH) | ||
|
|
||
| # Our library dependencies (contains definitions for IMPORTED targets) | ||
| include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake") | ||
| if(TARGET yaml-cpp) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be set on the target, not done like this. |
||
| set_property(TARGET yaml-cpp APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES | ||
| "${YAML_CPP_INCLUDE_DIR}" | ||
| ) | ||
| endif() | ||
|
|
||
| # These are IMPORTED targets created by yaml-cpp-targets.cmake | ||
| set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@") | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is correct;
include_directoriesis usually passed an absolute path. At best, this change is superfluous.