From c20ab7d6d89681c5435c11c5d5e128c0ac367047 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Mon, 13 Nov 2023 20:13:27 -0700 Subject: [PATCH] Ensure GNUInstallDirs cache vars are included before first used --- CMakeLists.txt | 8 ++++++++ cmake/Config.cmake | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc9a268e5..27e5de5fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -301,6 +301,14 @@ endif() sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES ${SFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML") 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 "/${CMAKE_INSTALL_LIBDIR}/pkgconfig") + + if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) + 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") foreach(sfml_module IN ITEMS all system window graphics audio network) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 48bf1d03d..d753f7ac3 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -73,14 +73,6 @@ else() return() endif() -# set pkgconfig install directory -# this could be e.g. macports on mac or msys2 on windows etc. -set(SFML_PKGCONFIG_DIR "/${CMAKE_INSTALL_LIBDIR}/pkgconfig") - -if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) - set(SFML_PKGCONFIG_DIR "/libdata/pkgconfig") -endif() - # detect the compiler and its version # Note: The detection is order is important because: # - Visual Studio can both use MSVC and Clang