feat: add pkg-config find libs

This commit is contained in:
huangminhang 2022-03-16 17:25:29 +08:00
parent 13f08c1557
commit 9ad4d99948
3 changed files with 49 additions and 0 deletions

View File

@ -599,6 +599,30 @@ configure_package_config_file(
PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CIVETWEB_ENABLE_CXX
)
configure_file(
cmake/${PROJECT_NAME}.pc.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc
@ONLY
)
configure_file(
cmake/${PROJECT_NAME}-cpp.pc.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}-cpp.pc
@ONLY
)
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc"
DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig"
)
install(
FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}-cpp.pc"
DESTINATION "${CMAKE_INSTALL_DATADIR}/pkgconfig"
)
write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake
VERSION ${CIVETWEB_VERSION}
COMPATIBILITY AnyNewerVersion

12
cmake/civetweb-cpp.pc.in Normal file
View File

@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
Name: @PROJECT_NAME@-cpp
Description: generic graph library
Version: @PROJECT_VERSION@
Requires:
Libs: -L${libdir} -l@PROJECT_NAME@-cpp
Cflags: -I${includedir}

13
cmake/civetweb.pc.in Normal file
View File

@ -0,0 +1,13 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
Name: @PROJECT_NAME@
Description: generic graph library
Version: @PROJECT_VERSION@
Requires:
Libs: -L${libdir} -l@PROJECT_NAME@
Cflags: -I${includedir}