Skip to content

Commit

Permalink
Configure pkg-config file by CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
thbeu committed Nov 23, 2023
1 parent e8ff9de commit b8acf5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ file(RELATIVE_PATH RELATIVE_LIBDIR

message(STATUS "CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}")

set(SHAPELIB_PC ${CMAKE_CURRENT_BINARY_DIR}/shapelib.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/shapelib.pc.cmake.in
${SHAPELIB_PC} @ONLY
)

if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
# Set a default build type for single-configuration cmake generators
# if no build type is set.
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ EXTRA_DIST = makefile.vc CMakeLists.txt autogen.sh \
cmake/contrib.cmake \
cmake/project-config-version.cmake.in \
cmake/project-config.cmake.in \
cmake/shapelib.pc.cmake.in \
tests/test1.sh tests/test2.sh tests/test3.sh \
tests/stream1.out tests/stream1.out tests/stream1.out \
web/maptools.css \
Expand Down
12 changes: 12 additions & 0 deletions cmake/shapelib.pc.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
datarootdir=${prefix}/share
datadir=${datarootdir}
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@

Name: shapelib
Description: C API for processing ESRI Shapefiles
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lshp
Cflags: -I${includedir}

0 comments on commit b8acf5c

Please sign in to comment.