CMake: Fix generated config.
- `YAML_CPP_SHARED_LIBS_BUILT` should not be set with a `PATH_VAR` as it would always evaluate to true. - `YAML_CPP_LIBRARIES` should used the exported target name including the namespace, but `check_required_components` shouldn't. - Use `CMAKE_CURRENT_LIST_DIR` to find the target file, instead of a `PATH_VAR`. Package managers such as vcpkg move CMake configs after installing.
This commit is contained in:
parent
69535873b4
commit
5682a0c097
@ -146,12 +146,12 @@ set_target_properties(yaml-cpp PROPERTIES
|
||||
PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
|
||||
DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
|
||||
|
||||
set(EXPORT_TARGETS yaml-cpp)
|
||||
set(EXPORT_TARGETS yaml-cpp::yaml-cpp)
|
||||
configure_package_config_file(
|
||||
"${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
|
||||
INSTALL_DESTINATION "${YAML_CPP_INSTALL_CMAKEDIR}"
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR YAML_BUILD_SHARED_LIBS)
|
||||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR)
|
||||
unset(EXPORT_TARGETS)
|
||||
|
||||
write_basic_package_version_file(
|
||||
|
||||
@ -11,12 +11,12 @@ set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
|
||||
set_and_check(YAML_CPP_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
|
||||
|
||||
# Are we building shared libraries?
|
||||
set(YAML_CPP_SHARED_LIBS_BUILT "@PACKAGE_YAML_BUILD_SHARED_LIBS@")
|
||||
set(YAML_CPP_SHARED_LIBS_BUILT @YAML_BUILD_SHARED_LIBS@)
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)
|
||||
include("${CMAKE_CURRENT_LIST_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@)
|
||||
check_required_components(yaml-cpp)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user