cmake: file(RELATIVE_PATH) needs 2 absolute paths

This commit is contained in:
Anonymous Maarten 2023-10-30 19:50:35 +01:00
parent dcc8805c21
commit 4aacc4b92e
1 changed files with 3 additions and 0 deletions

View File

@ -332,6 +332,9 @@ function(configure_sdl3_pc)
endif()
# Calculate prefix relative to location of sdl3.pc
if(NOT IS_ABSOLUTE "${CMAKE_INSTALL_PREFIX}")
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_PREFIX}")
endif()
file(RELATIVE_PATH SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${CMAKE_INSTALL_PREFIX}/${SDL_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}")