From 2a0e37ec9a57bcd3958406c41c775cd90d3904eb Mon Sep 17 00:00:00 2001 From: Aditya Jha Date: Mon, 16 Mar 2026 13:25:24 +0000 Subject: [PATCH] Added pkg-config support --- sparta/CMakeLists.txt | 13 +++++++++++++ sparta/cmake/sparta.pc.in | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 sparta/cmake/sparta.pc.in diff --git a/sparta/CMakeLists.txt b/sparta/CMakeLists.txt index 59399b1c19..883f0841b5 100644 --- a/sparta/CMakeLists.txt +++ b/sparta/CMakeLists.txt @@ -144,6 +144,19 @@ endif () string (STRIP ${GIT_REPO_VERSION} GIT_REPO_VERSION) message (STATUS "Sparta Version: ${GIT_REPO_VERSION}") +#pkg-config support +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sparta.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/sparta.pc + @ONLY +) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/sparta.pc + DESTINATION lib/pkgconfig +) + + # Use ccache if we've got it. find_program (CCACHE_PROGRAM ccache) if (CCACHE_PROGRAM) diff --git a/sparta/cmake/sparta.pc.in b/sparta/cmake/sparta.pc.in new file mode 100644 index 0000000000..e21f67017d --- /dev/null +++ b/sparta/cmake/sparta.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: sparta +Description: High-performance C++ modeling framework +Version: @GIT_REPO_VERSION@ +Requires: yaml-cpp sqlite3 hdf5 +Libs: -L${libdir} -lsparta -lboost_program_options -lboost_filesystem -lboost_system -lboost_timer -lboost_serialization -lz +Cflags: -I${includedir} -std=c++17