From 7346d1ba3b82a7c7f0ad3aafb0db4adb41aa0d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Pe=C3=B1acoba=20Veigas?= Date: Mon, 3 Jul 2023 11:16:12 +0000 Subject: [PATCH] Add pkg-config support. I chose to use absolute paths for security (to like nix) --- CMakeLists.txt | 10 ++++++++++ ovni.pc.in | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 ovni.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 7813052..e21c946 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,12 @@ include(GNUInstallDirs) set(OVNI_CONFIG_RELDIR "${CMAKE_INSTALL_DATADIR}/ovni") set(OVNI_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${OVNI_CONFIG_RELDIR}") +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/ovni.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/ovni.pc + @ONLY +) + include(CheckIPOSupported) check_ipo_supported(RESULT ipo_available OUTPUT error LANGUAGES C) @@ -96,3 +102,7 @@ if(BUILD_TESTING) endif() install(DIRECTORY cfg/ DESTINATION "${OVNI_CONFIG_RELDIR}") +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/ovni.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +) diff --git a/ovni.pc.in b/ovni.pc.in new file mode 100644 index 0000000..e7fd703 --- /dev/null +++ b/ovni.pc.in @@ -0,0 +1,8 @@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ + +Name: ovni +Description: Obtuse but Versatile Nanoscale Instrumentation +Version: @PROJECT_VERSION@ +Libs: -L${libdir} -lovni +Cflags: -I${includedir}