mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 09:09:35 +08:00
Ensure exported package is relocatable
As per CMake's Importing and Exporting Guide[1], configure_package_config_file() should be used for configuring the package configuration file, not the regular configure_file() function. This ensures that a spdlog package built on one system (with a given directory tree) can be imported from a different system - e.g. creating a pre-compiled spdlog package for use on different systems. [1]: https://cmake.org/cmake/help/git-stage/guide/importing-exporting/index.html#id8
This commit is contained in:
@@ -307,7 +307,8 @@ if(SPDLOG_INSTALL)
|
||||
install(EXPORT spdlog DESTINATION ${export_dest_dir} NAMESPACE spdlog:: FILE ${config_targets_file})
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_file("${project_config_in}" "${project_config_out}" @ONLY)
|
||||
configure_package_config_file("${project_config_in}" "${project_config_out}"
|
||||
INSTALL_DESTINATION ${export_dest_dir})
|
||||
|
||||
write_basic_package_version_file("${version_config_file}" COMPATIBILITY SameMajorVersion)
|
||||
install(FILES "${project_config_out}" "${version_config_file}" DESTINATION "${export_dest_dir}")
|
||||
|
Reference in New Issue
Block a user