Генерация файла для pkg-config вынесена в отдельную функцию

This commit is contained in:
Andrei Astafev 2020-04-22 22:05:17 +03:00
parent 197e5b3939
commit c73c31b380
4 changed files with 8 additions and 6 deletions

View File

@ -31,6 +31,7 @@ include(CMLibCotire)
include(CMLibBuildTypes)
include(CMLibCommonTargetProperties)
include(CMLibCommonLibraryTarget)
include(CMLibPkgConfig)
include(CMLibCodeAnalysisPvsStudio)
include(CMLibCodeAnalysisClangAnalyze)
include(CMLibCodeAnalysisClangTidy)

View File

@ -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()

4
CMLibPkgConfig.cmake Normal file
View File

@ -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()

View File

@ -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@