Skip to content

Commit

Permalink
Use a relative install path for pkgconfig files
Browse files Browse the repository at this point in the history
This allows the pkgconfig install path to still be correct when changing the CMAKE_INSTALL_PREFIX after the first cmake run.
  • Loading branch information
texus authored and eXpl0it3r committed May 14, 2024
1 parent 3acc332 commit e4c2d0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,21 @@ sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES ${SFML_INSTALL_PKGCONFIG_DEFAULT} B
if(SFML_INSTALL_PKGCONFIG_FILES)
# set pkgconfig install directory
# this could be e.g. macports on mac or msys2 on windows etc.
set(SFML_PKGCONFIG_DIR "/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
set(SFML_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
set(SFML_PKGCONFIG_DIR "/libdata/pkgconfig")
set(SFML_PKGCONFIG_DIR "libdata/pkgconfig")
endif()

sfml_set_option(SFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${SFML_PKGCONFIG_DIR}" PATH "Install directory for SFML's pkg-config .pc files")
sfml_set_option(SFML_PKGCONFIG_INSTALL_DIR "${SFML_PKGCONFIG_DIR}" PATH "Install directory for SFML's pkg-config .pc files")

foreach(sfml_module IN ITEMS all system window graphics audio network)
configure_file(
"tools/pkg-config/sfml-${sfml_module}.pc.in"
"tools/pkg-config/sfml-${sfml_module}.pc"
@ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
DESTINATION "${SFML_PKGCONFIG_INSTALL_PREFIX}")
DESTINATION "${SFML_PKGCONFIG_INSTALL_DIR}")
endforeach()
endif()

Expand Down

0 comments on commit e4c2d0a

Please sign in to comment.