Update Findsodium.cmake

When libsodium is build and installed from source, the line:
list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES)
generates an error because sodium_PKG_STATIC_LIBRARIES is empty
The proposed change fixes this issue
This commit is contained in:
SlavSlavov 2018-09-26 20:59:59 +01:00 committed by Frank Denis
parent 675a899d11
commit c0cb0a9f98

View File

@ -55,16 +55,16 @@ if (UNIX)
endif() endif()
if(sodium_USE_STATIC_LIBS) if(sodium_USE_STATIC_LIBS)
if (sodium_PKG_STATIC_LIBRARIES STREQUAL)
foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) foreach(_libname ${sodium_PKG_STATIC_LIBRARIES})
if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a
list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a")
endif() endif()
endforeach() endforeach()
list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES)
else()
# if pkgconfig for libsodium doesn't provide # if pkgconfig for libsodium doesn't provide
# static lib info, then override PKG_STATIC here.. # static lib info, then override PKG_STATIC here..
if (sodium_PKG_STATIC_LIBRARIES STREQUAL "")
set(sodium_PKG_STATIC_LIBRARIES libsodium.a) set(sodium_PKG_STATIC_LIBRARIES libsodium.a)
endif() endif()