Skip to content

Commit

Permalink
build: Install Sodium symlink on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ltoenning committed Dec 17, 2023
1 parent 46e6eab commit 3d79451
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cmake/sodium/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ if(UNIX AND NOT APPLE)
find_package(PkgConfig REQUIRED)
pkg_search_module(SODIUM REQUIRED libsodium)

# Adapted from CMake file() documentation to resolve symbolic link
file(READ_SYMLINK ${SODIUM_LINK_LIBRARIES} SODIUM_ABS)
if(NOT IS_ABSOLUTE "${SODIUM_ABS}")
get_filename_component(dir "${SODIUM_LINK_LIBRARIES}" DIRECTORY)
set(SODIUM_ABS "${dir}/${SODIUM_ABS}")
endif()
set_target_properties(externals_sodium PROPERTIES IMPORTED_SONAME ${SODIUM_ABS})

set_target_properties(externals_sodium PROPERTIES IMPORTED_LOCATION ${SODIUM_ABS})
string(REGEX MATCH "libsodium.so.[1-9]+" SOMAJOR_VERSION ${SODIUM_ABS})
get_filename_component(dir "${SODIUM_LINK_LIBRARIES}" DIRECTORY)
set(SOMAJOR_VERSION_ABS "${dir}/${SOMAJOR_VERSION}")
set_target_properties(externals_sodium PROPERTIES IMPORTED_LOCATION ${SOMAJOR_VERSION_ABS})
else()
target_include_directories(externals_sodium INTERFACE ${PROJECT_SOURCE_DIR}/externals/common/include)
endif()
Expand Down

0 comments on commit 3d79451

Please sign in to comment.