From c73c31b3800c134cbadc4e7fdff31e04553f0925 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Wed, 22 Apr 2020 22:05:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=B5=D0=BD=D0=B5=D1=80=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D1=8F=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20pkg-config=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D1=83=D1=8E=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMLibCommon.cmake | 1 + CMLibCommonLibraryTarget.cmake | 3 --- CMLibPkgConfig.cmake | 4 ++++ pc/lib.pc.in | 6 +++--- 4 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 CMLibPkgConfig.cmake diff --git a/CMLibCommon.cmake b/CMLibCommon.cmake index 558f0b2..f424288 100644 --- a/CMLibCommon.cmake +++ b/CMLibCommon.cmake @@ -31,6 +31,7 @@ include(CMLibCotire) include(CMLibBuildTypes) include(CMLibCommonTargetProperties) include(CMLibCommonLibraryTarget) +include(CMLibPkgConfig) include(CMLibCodeAnalysisPvsStudio) include(CMLibCodeAnalysisClangAnalyze) include(CMLibCodeAnalysisClangTidy) diff --git a/CMLibCommonLibraryTarget.cmake b/CMLibCommonLibraryTarget.cmake index 787cb08..7b4570e 100644 --- a/CMLibCommonLibraryTarget.cmake +++ b/CMLibCommonLibraryTarget.cmake @@ -35,7 +35,4 @@ function(add_common_library target) install(TARGETS ${target}_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() # cmake-format: on - - configure_file(${CMLIB_MODULE_DIR}/pc/lib.pc.in ${CMAKE_BINARY_DIR}/${target}.pc) - install(FILES ${CMAKE_BINARY_DIR}/${target}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endfunction() diff --git a/CMLibPkgConfig.cmake b/CMLibPkgConfig.cmake new file mode 100644 index 0000000..1bd7897 --- /dev/null +++ b/CMLibPkgConfig.cmake @@ -0,0 +1,4 @@ +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) +endfunction() diff --git a/pc/lib.pc.in b/pc/lib.pc.in index 8af23dc..4800826 100644 --- a/pc/lib.pc.in +++ b/pc/lib.pc.in @@ -3,11 +3,11 @@ exec_prefix=@CMAKE_INSTALL_PREFIX@ libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@ -Name: @current_target@ -Description: @current_target@ library +Name: @library_name@ +Description: @library_name@ library Version: @PROJECT_VERSION@ Requires: -Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@current_target@ +Libs: -L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ -l@library_name@ Cflags: -I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@