Skip to content

Commit

Permalink
build: set static finding options for sodium
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jun 15, 2023
1 parent f59d0d2 commit 1b58f5f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,21 @@ option(ENABLE_CURVE "Enable CURVE security" OFF)

if(ENABLE_CURVE)
if(WITH_LIBSODIUM)
if (WITH_LIBSODIUM_STATIC)
set(sodium_USE_STATIC_LIBS ON)
set(CPM_LIBSODIUM_SHARED OFF)
else()
set(sodium_USE_STATIC_LIBS OFF)
set(CPM_LIBSODIUM_SHARED ON)
endif()
find_package("sodium")
if (sodium_FOUND)
set(SODIUM_FOUND ON)
set(SODIUM_LIBRARIES sodium)
get_target_property(SODIUM_INCLUDE_DIRS sodium INTERFACE_INCLUDE_DIRECTORIES)
include_directories(${SODIUM_INCLUDE_DIRS})
elseif(NOT SODIUM_FOUND)
include(CPM)
if (WITH_LIBSODIUM_STATIC)
set(CPM_LIBSODIUM_SHARED OFF)
else()
set(CPM_LIBSODIUM_SHARED ON)
endif()
CPMAddPackage(
NAME libsodium
GITHUB_REPOSITORY robinlinden/libsodium-cmake
Expand Down

0 comments on commit 1b58f5f

Please sign in to comment.