Skip to content

Commit

Permalink
Packaging improvements
Browse files Browse the repository at this point in the history
1. It is now possible to install the library to an arbitrary prefix by
   setting CMAKE_INSTALL_PREFIX and SYSTEM_INSTALL
2. The filename of the library no longer conflicts with openssl when
   installed. This should not have an effect when using the library as a
   git submodule.
  • Loading branch information
Niautanor committed Aug 19, 2024
1 parent ee6d707 commit 0989519
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ IF(KMC_MDB_DB)
ENDIF(KMC_MDB_DB)

if(SYSTEM_INSTALL)
set(CMAKE_INSTALL_PREFIX /usr/local)
# The library will be installed to /usr/local unless overridden with
# -DCMAKE_INSTALL_PREFIX=/some/path
# See https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
elseif(NOT DEFINED CFE_SYSTEM_PSPNAME)
# Not cFE / cFS
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ endif()

file(GLOB CRYPTO_INCLUDES ../include/*.h)
set_target_properties(crypto PROPERTIES PUBLIC_HEADER "${CRYPTO_INCLUDES}")
# This causes the library to be installed as libcryptolib.so while still being
# referred to as crypto from CMake. Without this, the library filename would be
# libcrypto.so which would conflict with openssl
set_target_properties(crypto PROPERTIES OUTPUT_NAME "cryptolib")

add_custom_command(TARGET crypto POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:crypto> ${PROJECT_BINARY_DIR}/lib/libcrypto.so
Expand Down

0 comments on commit 0989519

Please sign in to comment.