From d542f43b2aa23966913c08e4973793150e8073d0 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 19 Oct 2022 16:03:43 +0200 Subject: [PATCH] cmake: add SDL_INSTALL_CMAKEDIR cache variable to override location of cmake config files --- CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c07a9d56..baa25e9d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3346,15 +3346,16 @@ if(NOT SDL2_DISABLE_INSTALL) ##### Export files ##### if (WINDOWS AND NOT MINGW) - set(PKG_PREFIX "cmake") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "cmake") else () - set(PKG_PREFIX "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") + set(SDL_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2") endif () + set(SDL_INSTALL_CMAKEDIR "${SDL_INSTALL_CMAKEDIR_DEFAULT}" CACHE STRING "Location where to install SDL2Config.cmake") include(CMakePackageConfigHelpers) configure_package_config_file(SDL2Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake" PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR - INSTALL_DESTINATION ${PKG_PREFIX} + INSTALL_DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake" VERSION ${SDL_VERSION} @@ -3365,7 +3366,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2Targets FILE SDL2Targets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2Targets @@ -3377,7 +3378,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2mainTargets FILE SDL2mainTargets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2mainTargets @@ -3389,7 +3390,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2staticTargets FILE SDL2staticTargets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2staticTargets @@ -3401,7 +3402,7 @@ if(NOT SDL2_DISABLE_INSTALL) install(EXPORT SDL2testTargets FILE SDL2testTargets.cmake NAMESPACE SDL2:: - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" ) if(ANDROID AND NOT CMAKE_VERSION VERSION_LESS 3.7) install(EXPORT_ANDROID_MK SDL2testTargets @@ -3413,7 +3414,7 @@ if(NOT SDL2_DISABLE_INSTALL) FILES ${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake - DESTINATION ${PKG_PREFIX} + DESTINATION "${SDL_INSTALL_CMAKEDIR}" COMPONENT Devel )