Skip to content

Commit

Permalink
Add generation of registry file for pkg-config
Browse files Browse the repository at this point in the history
  • Loading branch information
rherilier committed Sep 24, 2024
1 parent 9c90a95 commit 3ebbee0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .pkg-config/pegtl.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includedir="@CMAKE_INSTALL_PREFIX@/@PEGTL_INSTALL_INCLUDE_DIR@"

Name: @PROJECT_NAME@
Description: @CMAKE_PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
URL: @CMAKE_PROJECT_HOMEPAGE_URL@
Cflags: -I${includedir}
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ mark_as_advanced(${PROJECT_NAME}_DIR)
set(PEGTL_INSTALL_INCLUDE_DIR "include" CACHE STRING "The installation include directory")
set(PEGTL_INSTALL_DOC_DIR "share/doc/tao/pegtl" CACHE STRING "The installation doc directory")
set(PEGTL_INSTALL_CMAKE_DIR "share/pegtl/cmake" CACHE STRING "The installation cmake directory")
set(PEGTL_INSTALL_PKGCONFIG_DIR "share/pkgconfig" CACHE STRING "The installation pkgconfig directory")

# define a header-only library
add_library(pegtl INTERFACE)
Expand All @@ -62,9 +63,12 @@ if(PEGTL_BUILD_EXAMPLES)
add_subdirectory(src/example/pegtl)
endif()

# Make package findable
# Make package findable by CMake
configure_file(.cmake/pegtl-config.cmake.in pegtl-config.cmake @ONLY)

# Make package findable by pkg-config
configure_file(.pkg-config/pegtl.pc.in pegtl.pc @ONLY)

# Ignore pointer width differences since this is a header-only library
unset(CMAKE_SIZEOF_VOID_P)

Expand All @@ -82,6 +86,7 @@ install(EXPORT pegtl-targets
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pegtl-config-version.cmake DESTINATION ${PEGTL_INSTALL_CMAKE_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pegtl.pc DESTINATION ${PEGTL_INSTALL_PKGCONFIG_DIR})
install(DIRECTORY include/ DESTINATION ${PEGTL_INSTALL_INCLUDE_DIR})
install(FILES LICENSE_1_0.txt DESTINATION ${PEGTL_INSTALL_DOC_DIR})

Expand Down

0 comments on commit 3ebbee0

Please sign in to comment.