From 6b9f3e36c2358490b71e490d8c9fd1386e03c8c9 Mon Sep 17 00:00:00 2001 From: Bruno Van de Velde Date: Sun, 10 Mar 2024 11:21:38 +0100 Subject: [PATCH] Use a relative install path for pkgconfig files This allows the pkgconfig install path to still be correct when changing the CMAKE_INSTALL_PREFIX after the first cmake run. --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3f9f403e..d20776ef7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,13 +213,13 @@ if(SFML_INSTALL_PKGCONFIG_FILES) # set pkgconfig install directory # this could be e.g. macports on mac or msys2 on windows etc. - set(SFML_PKGCONFIG_DIR "/${SFML_RELATIVE_INSTALL_LIBDIR}/pkgconfig") + set(SFML_PKGCONFIG_DIR "${SFML_RELATIVE_INSTALL_LIBDIR}/pkgconfig") if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) - set(SFML_PKGCONFIG_DIR "/libdata/pkgconfig") + set(SFML_PKGCONFIG_DIR "libdata/pkgconfig") endif() - sfml_set_option(SFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${SFML_PKGCONFIG_DIR}" PATH "Install directory for SFML's pkg-config .pc files") + sfml_set_option(SFML_PKGCONFIG_INSTALL_DIR "${SFML_PKGCONFIG_DIR}" PATH "Install directory for SFML's pkg-config .pc files") foreach(sfml_module IN ITEMS all system window graphics audio network) configure_file( @@ -227,7 +227,7 @@ if(SFML_INSTALL_PKGCONFIG_FILES) "tools/pkg-config/sfml-${sfml_module}.pc" @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc" - DESTINATION "${SFML_PKGCONFIG_INSTALL_PREFIX}") + DESTINATION "${SFML_PKGCONFIG_INSTALL_DIR}") endforeach() endif()