[cmake] make generated pkg-config files relocatable

* new CMake option PKG_CONFIG_RELOCATABLE (default ON) allows generating
  traditional or relocatable pc files
This commit is contained in:
akallabeth 2023-10-09 10:00:58 +02:00 committed by akallabeth
parent 6250b0a5d4
commit 89429885a0
19 changed files with 25 additions and 9 deletions

View File

@ -92,6 +92,7 @@ if(WITH_CLIENT)
endforeach() endforeach()
endif() endif()
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-client.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-client.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-client${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@FREERDP_INCLUDE_DIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@

View File

@ -0,0 +1,6 @@
option(PKG_CONFIG_RELOCATABLE "Generate relocatable pkg-config files" ON)
if (PKG_CONFIG_RELOCATABLE)
set(PKG_CONFIG_INSTALL_PREFIX "\${pcfiledir}/../..")
else()
set(PKG_CONFIG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
endif()

View File

@ -436,6 +436,7 @@ endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp") set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@FREERDP_INCLUDE_DIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@

View File

@ -23,6 +23,8 @@ FOREACH(var ${res})
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
include(pkg-config-install-prefix)
string(REPLACE ";" " " RDTK_BUILD_CONFIG "${RDTK_BUILD_CONFIG_LIST}") string(REPLACE ";" " " RDTK_BUILD_CONFIG "${RDTK_BUILD_CONFIG_LIST}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/version.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/version.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/buildflags.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/rdtk/buildflags.h)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@RDTK_INCLUDE_DIR@ includedir=${prefix}/@RDTK_INCLUDE_DIR@

View File

@ -72,6 +72,7 @@ foreach(FREERDP_SERVER ${FREERDP_EXTRA_SERVERS})
add_subdirectory(${FREERDP_SERVER}) add_subdirectory(${FREERDP_SERVER})
endforeach() endforeach()
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-server.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-server.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp-server${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@FREERDP_INCLUDE_DIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@

View File

@ -88,6 +88,7 @@ if (WITH_DEBUG_SYMBOLS AND MSVC)
install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols) install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols)
endif() endif()
# pkg-config # pkg-config
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-proxy.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-proxy.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${MODULE_NAME}${FREERDP_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@FREERDP_INCLUDE_DIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@

View File

@ -214,6 +214,7 @@ endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow") set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Server/shadow")
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-shadow.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp-shadow.pc.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow${FREERDP_VERSION_MAJOR}.pc @ONLY)
configure_file(freerdp-shadow-cli.1.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1) configure_file(freerdp-shadow-cli.1.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1 1) install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/freerdp-shadow-cli.1 1)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@FREERDP_INCLUDE_DIR@ includedir=${prefix}/@FREERDP_INCLUDE_DIR@

View File

@ -35,6 +35,7 @@ configure_file(buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/build
configure_file(build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/build-config.h) configure_file(build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/build-config.h)
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/config.h) configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/../include/uwac/config.h)
include(pkg-config-install-prefix)
configure_file(uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY) configure_file(uwac.pc.in ${CMAKE_CURRENT_BINARY_DIR}/uwac${UWAC_VERSION_MAJOR}.pc @ONLY)
set(UWAC_INSTALL_INCLUDE_DIR ${UWAC_INCLUDE_DIR}/uwac) set(UWAC_INSTALL_INCLUDE_DIR ${UWAC_INCLUDE_DIR}/uwac)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@UWAC_INCLUDE_DIR@ includedir=${prefix}/@UWAC_INCLUDE_DIR@

View File

@ -343,6 +343,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WinPRConfig.cmake ${CMAKE_CURRENT_BINA
install(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR}) install(EXPORT WinPRTargets DESTINATION ${WINPR_CMAKE_INSTALL_DIR})
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr${WINPR_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -128,6 +128,7 @@ set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools")
add_subdirectory(makecert-cli) add_subdirectory(makecert-cli)
add_subdirectory(hash-cli) add_subdirectory(hash-cli)
include(pkg-config-install-prefix)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr-tools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr-tools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@WINPR_INCLUDE_DIR@ includedir=${prefix}/@WINPR_INCLUDE_DIR@

View File

@ -1,4 +1,4 @@
prefix=@CMAKE_INSTALL_PREFIX@ prefix=@PKG_CONFIG_INSTALL_PREFIX@
exec_prefix=${prefix} exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@WINPR_INCLUDE_DIR@ includedir=${prefix}/@WINPR_INCLUDE_DIR@