Skip to content

Commit

Permalink
Merge pull request #372 from rherilier/add-registry-file-for-pkg-config
Browse files Browse the repository at this point in the history
  • Loading branch information
uilianries authored Sep 28, 2024
2 parents f420443 + 3ebbee0 commit d7b821b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
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}
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ file(READ "${CMAKE_CURRENT_LIST_DIR}/include/tao/pegtl/version.hpp" version_hpp_
string(REGEX MATCH "#define TAO_PEGTL_VERSION \"([^\"]+)\"" _ ${version_hpp_data})
set(PEGTL_VERSION "${CMAKE_MATCH_1}")

project(pegtl VERSION ${PEGTL_VERSION} LANGUAGES CXX)
project(pegtl VERSION ${PEGTL_VERSION} DESCRIPTION "The Parsing Expression Grammar Template Library" HOMEPAGE_URL https://github.com/taocpp/PEGTL LANGUAGES CXX)

set(PEGTL_IS_MAIN_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
Expand Down 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 d7b821b

Please sign in to comment.