From fac6e9f1e2f9b3dcd528495bdb87e1c78aa49aa2 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Wed, 21 Apr 2021 06:27:41 +0200 Subject: [PATCH] sdl2-config.cmake.in: Use more CMake variables and less autotools ones this makes it easier to create a portable sdl2-config.cmake that doesn't hardcode its path (by replacing the hardcoded prefix with something like "${CMAKE_CURRENT_LIST_DIR}/../../..") --- sdl2-config.cmake.in | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in index a6fa0518f..77c4e1a0f 100644 --- a/sdl2-config.cmake.in +++ b/sdl2-config.cmake.in @@ -3,10 +3,11 @@ set(prefix "@prefix@") set(exec_prefix "@exec_prefix@") set(libdir "@libdir@") -set(SDL2_PREFIX "@prefix@") -set(SDL2_EXEC_PREFIX "@prefix@") -set(SDL2_LIBDIR "@libdir@") -set(SDL2_INCLUDE_DIRS "@includedir@/SDL2") +set(includedir "@includedir@") +set(SDL2_PREFIX "${prefix}") +set(SDL2_EXEC_PREFIX "${exec_prefix}") +set(SDL2_LIBDIR "${libdir}") +set(SDL2_INCLUDE_DIRS "${includedir}/SDL2") set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) @@ -20,7 +21,7 @@ if(NOT TARGET SDL2::SDL2) add_library(SDL2::SDL2 SHARED IMPORTED) set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}" # TODO: on windows set IMPORTED_IMPLIB to SDL2.lib @@ -28,9 +29,9 @@ if(NOT TARGET SDL2::SDL2) add_library(SDL2::SDL2-static STATIC IMPORTED) set_target_properties(SDL2::SDL2-static PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2" + INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}") add_library(SDL2::SDL2main STATIC IMPORTED)