Имя генерируемого файла для pkg-config
This commit is contained in:
parent
032fdee52b
commit
d7b6411ad3
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(myx-cmake VERSION 0.2.0 LANGUAGES)
|
||||
project(myx-cmake VERSION 0.2.4 LANGUAGES)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
file(WRITE ${CMAKE_SOURCE_DIR}/MyxCMake/MyxCMakeConfigVersion.cmake
|
||||
|
@ -1,39 +1,42 @@
|
||||
function(myx_cmake_generate_pkgconfig target)
|
||||
set(options)
|
||||
set(oneVA COMPONENT)
|
||||
set(oneVA COMPONENT BASENAME)
|
||||
set(multiVA)
|
||||
|
||||
cmake_parse_arguments(ARG "${options}" "${oneVA}" "${multiVA}" ${ARGN})
|
||||
|
||||
if(NOT ARG_BASENAME)
|
||||
set(ARG_BASENAME ${target})
|
||||
endif()
|
||||
|
||||
if(NOT ARG_COMPONENT)
|
||||
set(ARG_COMPONENT dev)
|
||||
endif()
|
||||
|
||||
get_target_property(_target_type ${target} TYPE)
|
||||
|
||||
if(_target_type STREQUAL INTERFACE_LIBRARY)
|
||||
get_target_property(__target_type ${target} TYPE)
|
||||
if(__target_type STREQUAL INTERFACE_LIBRARY)
|
||||
file(
|
||||
WRITE "${CMAKE_BINARY_DIR}/${target}.pc"
|
||||
WRITE "${CMAKE_BINARY_DIR}/${BASENAME}.pc"
|
||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"exec_prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n"
|
||||
"\n"
|
||||
"Name: ${target}\n"
|
||||
"Description: ${target} header-only library\n"
|
||||
"Name: ${BASENAME}\n"
|
||||
"Description: ${BASENAME} header-only library\n"
|
||||
"Version: ${PROJECT_VERSION}\n"
|
||||
"\n"
|
||||
"Requires:\n"
|
||||
"Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n")
|
||||
else()
|
||||
file(
|
||||
WRITE "${CMAKE_BINARY_DIR}/${target}.pc"
|
||||
WRITE "${CMAKE_BINARY_DIR}/${BASENAME}.pc"
|
||||
"prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"exec_prefix=${CMAKE_INSTALL_PREFIX}\n"
|
||||
"libdir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\n"
|
||||
"includedir=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n"
|
||||
"\n"
|
||||
"Name: ${target}\n"
|
||||
"Description: ${target} library\n"
|
||||
"Name: ${BASENAME}\n"
|
||||
"Description: ${BASENAME} library\n"
|
||||
"Version: ${PROJECT_VERSION}\n"
|
||||
"\n"
|
||||
"Requires:\n"
|
||||
@ -41,7 +44,7 @@ function(myx_cmake_generate_pkgconfig target)
|
||||
"Cflags: -I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}\n")
|
||||
endif()
|
||||
install(
|
||||
FILES "${CMAKE_BINARY_DIR}/${target}.pc"
|
||||
FILES "${CMAKE_BINARY_DIR}/${BASENAME}.pc"
|
||||
COMPONENT ${ARG_COMPONENT}
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
endfunction()
|
||||
|
Loading…
Reference in New Issue
Block a user