From 21ba95ade58dcdc2ab2a33467c3eb3d6a2909a46 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Mon, 22 Feb 2021 16:34:42 -0500 Subject: [PATCH] create and install a pkg-config file on Unix-like systems --- CMakeLists.txt | 12 +++++++++++- olm.pc.in | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 olm.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b049e4..3c6e768 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,10 +64,14 @@ set_target_properties(olm PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +include(GNUInstallDirs) + +# Make a pkg-config file +configure_file(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX) + # # Installation # -include(GNUInstallDirs) set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Olm) install(TARGETS olm EXPORT olm-targets @@ -86,6 +90,12 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/olm/sas.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/olm) +if (UNIX AND NOT APPLE) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + ) +endif () + # Export the targets to a script. install(EXPORT olm-targets FILE OlmTargets.cmake diff --git a/olm.pc.in b/olm.pc.in new file mode 100644 index 0000000..6f189bd --- /dev/null +++ b/olm.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ + +Name: olm +Description: implementation of the Double Ratchet cryptographic ratchet in C++ +Version: @PROJECT_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lolm