From ad9edb0256a88643279ff43fe8d793033a9ea69b Mon Sep 17 00:00:00 2001 From: kimci86 Date: Fri, 23 Feb 2024 22:42:38 +0100 Subject: [PATCH] Use relative install path for pkgconfig files It is recommended in CMake's official documentation to use relative path for DESTINATION parameter. Using absolute paths do not work with the cmake --install command's --prefix option. --- CMakeLists.txt | 4 ++-- cmake/Config.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09cadae..8190de4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,7 @@ endif() csfml_set_option(CSFML_INSTALL_PKGCONFIG_FILES ${CSFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML") if(CSFML_INSTALL_PKGCONFIG_FILES) - csfml_set_option(CSFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files") + csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files") foreach(csfml_module IN ITEMS all system window graphics audio network) configure_file( @@ -76,7 +76,7 @@ if(CSFML_INSTALL_PKGCONFIG_FILES) "tools/pkg-config/csfml-${csfml_module}.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/csfml-${csfml_module}.pc" - DESTINATION "${CSFML_PKGCONFIG_INSTALL_PREFIX}") + DESTINATION "${CSFML_PKGCONFIG_INSTALL_DIR}") endforeach() endif() diff --git a/cmake/Config.cmake b/cmake/Config.cmake index c2b7236..450707b 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -34,10 +34,10 @@ endif() # set pkgconfig install directory # this could be e.g. macports on mac or msys2 on windows etc. -set(CSFML_PKGCONFIG_DIR "/${CMAKE_INSTALL_LIBDIR}/pkgconfig") +set(CSFML_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig") if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) - set(CSFML_PKGCONFIG_DIR "/libdata/pkgconfig") + set(CSFML_PKGCONFIG_DIR "libdata/pkgconfig") endif() # detect the compiler and its version