cmake: add RELOCATABLE_PKGCONFIG option

This commit is contained in:
Cristian Morales Vega 2020-11-06 10:31:08 +00:00
parent 06ab1f6f3e
commit d9edfd4ac9
2 changed files with 13 additions and 0 deletions

View File

@ -416,10 +416,21 @@ file(RELATIVE_PATH top_builddir "${CMAKE_CURRENT_BINARY_DIR}/dir" "${CMAKE_CURRE
set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
set(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
# libnghttp2.pc (pkg-config file)
if(RELOCATABLE_PKGCONFIG)
file(RELATIVE_PATH PKGCONF_TO_PREFIX "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH EXEC_PREFIX_TO_LIBDIR "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_LIBDIR}")
file(RELATIVE_PATH PREFIX_TO_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
set(prefix "\${pcfiledir}/${PKGCONF_TO_PREFIX}")
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${EXEC_PREFIX_TO_LIBDIR}")
set(includedir "\${prefix}/${PREFIX_TO_INCLUDEDIR}")
else()
set(prefix "${CMAKE_INSTALL_PREFIX}")
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
endif()
set(VERSION "${PACKAGE_VERSION}")
# For init scripts and systemd service file (in contrib/)
set(bindir "${CMAKE_INSTALL_FULL_BINDIR}")

View File

@ -27,4 +27,6 @@ option(WITH_SPDYLAY "Use spdylay"
option(WITH_MRUBY "Use mruby")
option(WITH_NEVERBLEED "Use neverbleed")
option(RELOCATABLE_PKGCONFIG "Make the pkg-config files relocatable")
# vim: ft=cmake: