create and install a pkg-config file on Unix-like systems

This commit is contained in:
Hubert Chathi 2021-02-22 16:34:42 -05:00
parent cabefb17dc
commit 21ba95ade5
2 changed files with 21 additions and 1 deletions

View file

@ -64,10 +64,14 @@ set_target_properties(olm PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}
RUNTIME_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 # Installation
# #
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Olm) set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Olm)
install(TARGETS olm install(TARGETS olm
EXPORT olm-targets EXPORT olm-targets
@ -86,6 +90,12 @@ install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/olm/sas.h ${CMAKE_CURRENT_SOURCE_DIR}/include/olm/sas.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/olm) 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. # Export the targets to a script.
install(EXPORT olm-targets install(EXPORT olm-targets
FILE OlmTargets.cmake FILE OlmTargets.cmake

10
olm.pc.in Normal file
View file

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