Правка работы с PkgConfig

This commit is contained in:
Andrei Astafev 2021-12-24 15:09:01 +03:00
parent 178412c505
commit c82b5f29f1
2 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(myx-cmake VERSION 0.4.2 LANGUAGES) project(myx-cmake VERSION 0.4.4 LANGUAGES)
include(GNUInstallDirs) include(GNUInstallDirs)
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake

View File

@ -16,27 +16,27 @@ function(myx_cmake_generate_pkgconfig target)
get_target_property(__target_type ${target} TYPE) get_target_property(__target_type ${target} TYPE)
if(__target_type STREQUAL INTERFACE_LIBRARY) if(__target_type STREQUAL INTERFACE_LIBRARY)
file( file(
WRITE "${CMAKE_BINARY_DIR}/${BASENAME}.pc" WRITE "${CMAKE_BINARY_DIR}/${ARG_BASENAME}.pc"
"prefix=${CMAKE_INSTALL_PREFIX}\n" "prefix=${CMAKE_INSTALL_PREFIX}\n"
"exec_prefix=${CMAKE_INSTALL_PREFIX}\n" "exec_prefix=${CMAKE_INSTALL_PREFIX}\n"
"includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n" "includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n"
"\n" "\n"
"Name: ${BASENAME}\n" "Name: ${ARG_BASENAME}\n"
"Description: ${BASENAME} header-only library\n" "Description: ${ARG_BASENAME} header-only library\n"
"Version: ${PROJECT_VERSION}\n" "Version: ${PROJECT_VERSION}\n"
"\n" "\n"
"Requires:\n" "Requires:\n"
"Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n") "Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n")
else() else()
file( file(
WRITE "${CMAKE_BINARY_DIR}/${BASENAME}.pc" WRITE "${CMAKE_BINARY_DIR}/${ARG_BASENAME}.pc"
"prefix=${CMAKE_INSTALL_PREFIX}\n" "prefix=${CMAKE_INSTALL_PREFIX}\n"
"exec_prefix=${CMAKE_INSTALL_PREFIX}\n" "exec_prefix=${CMAKE_INSTALL_PREFIX}\n"
"libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\n" "libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\n"
"includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n" "includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n"
"\n" "\n"
"Name: ${BASENAME}\n" "Name: ${ARG_BASENAME}\n"
"Description: ${BASENAME} library\n" "Description: ${ARG_BASENAME} library\n"
"Version: ${PROJECT_VERSION}\n" "Version: ${PROJECT_VERSION}\n"
"\n" "\n"
"Requires:\n" "Requires:\n"
@ -44,7 +44,7 @@ function(myx_cmake_generate_pkgconfig target)
"Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n") "Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n")
endif() endif()
install( install(
FILES "${CMAKE_BINARY_DIR}/${BASENAME}.pc" FILES "${CMAKE_BINARY_DIR}/${ARG_BASENAME}.pc"
COMPONENT ${ARG_COMPONENT} COMPONENT ${ARG_COMPONENT}
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
endfunction() endfunction()