Skip to content

Commit

Permalink
Handle absolute include and lib paths in cmake
Browse files Browse the repository at this point in the history
(cherry picked from commit 4fc7410)
  • Loading branch information
marcin-serwin authored and slouken committed Mar 3, 2025
1 parent ccaffa2 commit d185bae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,17 @@ if(SDLIMAGE_INSTALL)
set(SDL_PKGCONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()

if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(INCLUDEDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(LIBDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_LIBDIR}")
else()
set(LIBDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
endif()

string(JOIN " " PC_REQUIRES ${PC_REQUIRES})
string(JOIN " " PC_LIBS ${PC_LIBS})
configure_file(cmake/sdl3-image.pc.in sdl3-image.pc @ONLY)
Expand Down
4 changes: 2 additions & 2 deletions cmake/sdl3-image.pc.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix=@SDL_PKGCONFIG_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=@LIBDIR_FOR_PKG_CONFIG@
includedir=@INCLUDEDIR_FOR_PKG_CONFIG@

Name: @PROJECT_NAME@
Description: image loading library for Simple DirectMedia Layer
Expand Down

0 comments on commit d185bae

Please sign in to comment.