From ea2b322df6b3c53b4d9004f5ed945f496c9291c6 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Wed, 22 Apr 2020 22:25:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20pkg-config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibPkgConfig.cmake | 14 ++++++++++++-- pc/lib-header-only.pc.in | 11 +++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 pc/lib-header-only.pc.in diff --git a/CMLibPkgConfig.cmake b/CMLibPkgConfig.cmake index 1bd7897..aaef671 100644 --- a/CMLibPkgConfig.cmake +++ b/CMLibPkgConfig.cmake @@ -1,4 +1,14 @@ function(generate_pkgconfig library_name) - configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${library_name}.pc) - install(FILES ${CMAKE_BINARY_DIR}/${library_name}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + set(options) + set(oneValueArgs COMPONENT INSTALL_LIBRARY) + set(multiValueArgs) + + cmake_parse_arguments(_PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(${_PKG_INSTALL_LIBRARY}) + configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${library_name}.pc) + else() + configure_file(${CMLIB_MODULE_DIR}/pc/lib-header-only.pc.in ${CMAKE_BINARY_DIR}/${library_name}.pc) + endif() + install(FILES ${CMAKE_BINARY_DIR}/${library_name}.pc COMPONENT ${_PKG_COMPONENT} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endfunction() diff --git a/pc/lib-header-only.pc.in b/pc/lib-header-only.pc.in new file mode 100644 index 0000000..61b6119 --- /dev/null +++ b/pc/lib-header-only.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: @library_name@ +Description: @library_name@ library +Version: @PROJECT_VERSION@ + +Requires: +Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ +