Skip to content

Commit fff406d

Browse files
MrHerrngistrec
andcommitted
Added pkg-config (.pc) file for non-CMake consumers
Co-authored-by: Aleksandr Kovalko <[email protected]>
1 parent 3c584b2 commit fff406d

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ install(FILES
131131
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtils
132132
)
133133

134+
# pkg-config
135+
option(GEO_UTILS_INSTALL_PKGCONFIG "Install a pkg-config (.pc) file" ON)
136+
if(GEO_UTILS_INSTALL_PKGCONFIG)
137+
configure_file(
138+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/geo-utils.pc.in
139+
${CMAKE_CURRENT_BINARY_DIR}/geo-utils.pc
140+
@ONLY
141+
)
142+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geo-utils.pc
143+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
144+
)
145+
endif()
146+
134147
if(_geo_utils_is_top_level)
135148
set(CPACK_PACKAGE_NAME "geo-utils")
136149
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")

cmake/geo-utils.pc.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=${prefix}
3+
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4+
5+
Name: geo-utils
6+
Description: Header-only C++ geographic utilities
7+
URL: https://github.com/gistrec/geo-utils
8+
Version: @PROJECT_VERSION@
9+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)