Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Commit

Permalink
feat: add pkg-config find libs
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminhang committed Mar 16, 2022
1 parent 13f08c1 commit 9ad4d99
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions cmake/civetweb-cpp.pc.in
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions cmake/civetweb.pc.in
Original file line number Diff line number Diff line change
@@ -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}


0 comments on commit 9ad4d99

Please sign in to comment.