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@