Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cmake: output cpptoml.pc for pkg-config discoverability #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ target_include_directories(cpptoml INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it, we might want to use GNUInstallDirs for this so that CMAKE_INSTALL_INCLUDEDIR is respected, see https://github.com/jtojnar/cmake-snips#hardcoding-the-installation-paths.


configure_file(
"${PROJECT_SOURCE_DIR}/cpptoml.pc.in"
"${PROJECT_SOURCE_DIR}/cpptoml.pc"
@ONLY)

if (LIBDL_LIBRARY)
target_link_libraries(cpptoml INTERFACE ${LIBDL_LIBRARY})
endif()
Expand Down Expand Up @@ -87,6 +92,8 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cpptoml/cpptomlConfig.cmake
DESTINATION
lib/cmake/cpptoml)
install(FILES "${PROJECT_SOURCE_DIR}/cpptoml.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

export(EXPORT cpptoml-exports
FILE ${CMAKE_CURRENT_BINARY_DIR}/cpptoml/cpptomlTargets.cmake)
Expand Down
7 changes: 7 additions & 0 deletions cpptoml.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
includedir=${prefix}/include

Name: cpptoml
Description: A header-only library for parsing TOML
Version: @cpptoml_VERSION@
Cflags: -I${includedir}