Skip to content

Commit

Permalink
Add support for pkg-config (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
mschoema authored Aug 28, 2024
1 parent da4cfdc commit fa470ee
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
31 changes: 30 additions & 1 deletion meos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ if(DEBUG_EXPAND)
message(STATUS "Showing debug messages for expandable data structures")
endif()

#-----------------------------------------------------------------------------
# Install directories
#-----------------------------------------------------------------------------

include(GNUInstallDirs)

#-----------------------------------------
# Set default PostgreSQL Version for MEOS
#-----------------------------------------
Expand Down Expand Up @@ -208,9 +214,32 @@ else()
endif()

#-----------------------------------------------------------------------------
# Documentation
# Configure pkg-config file meos.pc
#-----------------------------------------------------------------------------

# Consider CMAKE_INSTALL_PREFIX with spaces
string(REPLACE " " "\\ " prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "$\{prefix\}")
if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
else()
set(includedir "$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}")
endif()
if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(libdir "${CMAKE_INSTALL_LIBDIR}")
else()
set(libdir "$\{exec_prefix\}/${CMAKE_INSTALL_LIBDIR}")
endif()
set(VERSION ${MEOS_LIB_VERSION})

configure_file(
${CMAKE_SOURCE_DIR}/tools/meos.pc.in
${CMAKE_BINARY_DIR}/meos.pc
@ONLY)

install(
FILES ${CMAKE_BINARY_DIR}/meos.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

#-----------------------------------------------------------------------------
# The End
Expand Down
11 changes: 11 additions & 0 deletions tools/meos.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
includedir=@includedir@
libdir=@libdir@

Name: MEOS
Description: Mobility Engine, Open Source - C API
Requires:
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lmeos

0 comments on commit fa470ee

Please sign in to comment.