From e657092392655a0710e56be6c2d0259266a90116 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 28 Dec 2024 02:07:29 +0100 Subject: [PATCH] cmake: don't create relocatable packages by default with non-MSVC toolchains --- CMakeLists.txt | 11 ++++++++--- build-scripts/release-info.json | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc9c893..44d03e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ cmake_dependent_option(SDLIMAGE_INSTALL "Enable SDL3_image install target" ${SDL cmake_dependent_option(SDLIMAGE_INSTALL_CPACK "Create binary SDL3_image archive using CPack" ${SDLIMAGE_ROOTPROJECT} "SDLIMAGE_INSTALL" OFF) cmake_dependent_option(SDLIMAGE_INSTALL_MAN "Install man pages for SDL3_image" OFF "SDLIMAGE_INSTALL" OFF) cmake_dependent_option(SDLIMAGE_DEPS_SHARED "Load dependencies dynamically" ON PLATFORM_SUPPORTS_SHARED OFF) +cmake_dependent_option(SDLIMAGE_RELOCATABLE "Create relocatable SDL_image package" "${MSVC}" SDLIMAGE_INSTALL OFF) option(SDLIMAGE_VENDORED "Use vendored third-party libraries" ${vendored_default}) option(SDLIMAGE_WERROR "Treat warnings as errors" OFF) @@ -1076,9 +1077,13 @@ if(SDLIMAGE_INSTALL) COMPONENT devel ) - file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDLIMAGE_PKGCONFIG_INSTALLDIR}" "${CMAKE_INSTALL_PREFIX}") - string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}") - set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}") + if(SDLIMAGE_RELOCATABLE) + file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDLIMAGE_PKGCONFIG_INSTALLDIR}" "${CMAKE_INSTALL_PREFIX}") + string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}") + set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}") + else() + set(SDL_PKGCONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}") + endif() string(JOIN " " PC_REQUIRES ${PC_REQUIRES}) string(JOIN " " PC_LIBS ${PC_LIBS}) diff --git a/build-scripts/release-info.json b/build-scripts/release-info.json index 67d863c9..f26e4a94 100644 --- a/build-scripts/release-info.json +++ b/build-scripts/release-info.json @@ -53,6 +53,7 @@ "-DSDLIMAGE_XCF=ON", "-DSDLIMAGE_XPM=ON", "-DSDLIMAGE_XV=ON", + "-DSDLIMAGE_RELOCATABLE=ON", "-DSDLIMAGE_SAMPLES=OFF", "-DSDLIMAGE_TESTS=OFF", "-DSDLIMAGE_VENDORED=OFF" @@ -148,6 +149,7 @@ "-DSDLIMAGE_XCF=ON", "-DSDLIMAGE_XPM=ON", "-DSDLIMAGE_XV=ON", + "-DSDLIMAGE_RELOCATABLE=ON", "-DSDLIMAGE_SAMPLES=OFF", "-DSDLIMAGE_TESTS=OFF", "-DSDLIMAGE_VENDORED=ON"