Add pkg-config support. I chose to use absolute paths for security (to like nix)

This commit is contained in:
Raúl Peñacoba Veigas 2023-07-03 11:16:12 +00:00
parent 5a9086e6d1
commit 7346d1ba3b
2 changed files with 18 additions and 0 deletions

View File

@ -36,6 +36,12 @@ include(GNUInstallDirs)
set(OVNI_CONFIG_RELDIR "${CMAKE_INSTALL_DATADIR}/ovni") set(OVNI_CONFIG_RELDIR "${CMAKE_INSTALL_DATADIR}/ovni")
set(OVNI_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${OVNI_CONFIG_RELDIR}") 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) include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_available OUTPUT error LANGUAGES C) check_ipo_supported(RESULT ipo_available OUTPUT error LANGUAGES C)
@ -96,3 +102,7 @@ if(BUILD_TESTING)
endif() endif()
install(DIRECTORY cfg/ DESTINATION "${OVNI_CONFIG_RELDIR}") install(DIRECTORY cfg/ DESTINATION "${OVNI_CONFIG_RELDIR}")
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ovni.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

8
ovni.pc.in Normal file
View File

@ -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}