CMakeLists.txt: Use relative paths for DESTINATION

According to the documentation, it is not recommended to use absolute
paths as DESTINATION. [1] Because of this, CPack was failing to package
NSIS-based installers.

INSTALL_DESTINATION can be an absolute path, but it does not provide any
value since CMAKE_INSTALL_PREFIX is assumed as the default
INSTALL_PREFIX. [2]

[1]: https://cmake.org/cmake/help/latest/command/install.html
[2]: https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html
This commit is contained in:
Xavier Del Campo Romero 2025-01-13 21:48:49 +01:00
parent 922272e430
commit 1d84fdcdf7
Signed by: xavi
GPG key ID: 84FF3612A9BF43F2

View file

@ -17,7 +17,7 @@ include(CMakePackageConfigHelpers)
configure_package_config_file(
cmake/${PROJECT_NAME}.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
PATH_VARS datadir
)
@ -30,7 +30,7 @@ write_basic_package_version_file(
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${PROJECT_NAME}
DESTINATION lib/cmake/${PROJECT_NAME}
)
add_subdirectory(data)