Add preference to libsodium static lib
This commit is contained in:
parent
c2982c1e54
commit
da54d0e314
1 changed files with 14 additions and 1 deletions
|
@ -50,7 +50,20 @@ else()
|
|||
pkg_check_modules(LIBSODIUM QUIET libsodium)
|
||||
if(LIBSODIUM_FOUND)
|
||||
target_compile_definitions(UDPC PUBLIC UDPC_LIBSODIUM_ENABLED)
|
||||
|
||||
# Try to link with static lib by default.
|
||||
foreach(LIB_DIR IN LISTS ${LIBSODIUM_LIBRARY_DIRS})
|
||||
if(EXISTS "${LIB_DIR}/libsodium.a")
|
||||
set(LIBSODIUM_STATIC_LIB "${LIB_DIR}/libsodium.a")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(EXISTS ${LIBSODIUM_STATIC_LIB})
|
||||
target_link_libraries(UDPC PUBLIC ${LIBSODIUM_STATIC_LIB})
|
||||
else()
|
||||
target_link_libraries(UDPC PUBLIC ${LIBSODIUM_LIBRARIES})
|
||||
endif()
|
||||
target_include_directories(UDPC PUBLIC ${LIBSODIUM_INCLUDE_DIRS})
|
||||
target_compile_options(UDPC PUBLIC ${LIBSODIUM_CFLAGS_OTHER})
|
||||
message(STATUS "libsodium enabled")
|
||||
|
|
Loading…
Reference in a new issue