mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-08 12:21:17 +00:00
Fix CMake export files (#1077)
After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with empty variables. (see also the discussion in #774). Rework this file and the call to `configure_package_config_file` according the cmake documentation (https://cmake.org/cmake/help/v3.22/module/CMakePackageConfigHelpers.html?highlight=configure_package_config#command:configure_package_config_file) to overcome this issue and allow a simple `find_package` after install. As there was some discussion about the place where to install the `yaml-cpp-config.cmake` file, e.g. #1055, factor out the install location into an extra variable to make it easier changing this location in the future. Also untabify CMakeLists.txt in some places to align with the other code parts in this file.
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
# YAML_CPP_INCLUDE_DIR - include directory
|
||||
# YAML_CPP_LIBRARIES - libraries to link against
|
||||
|
||||
# Compute paths
|
||||
get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
|
||||
include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)
|
||||
|
||||
# These are IMPORTED targets created by yaml-cpp-targets.cmake
|
||||
set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")
|
||||
|
||||
check_required_components(@EXPORT_TARGETS@)
|
||||
|
Reference in New Issue
Block a user