From c0cb0a9f98716f5e6cdb91ee86fd062b3ce04712 Mon Sep 17 00:00:00 2001 From: SlavSlavov <26271135+SlavSlavov@users.noreply.github.com> Date: Wed, 26 Sep 2018 20:59:59 +0100 Subject: [PATCH] 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 --- contrib/Findsodium.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/Findsodium.cmake b/contrib/Findsodium.cmake index 30e6f5c1..a846303c 100644 --- a/contrib/Findsodium.cmake +++ b/contrib/Findsodium.cmake @@ -55,16 +55,16 @@ if (UNIX) endif() if(sodium_USE_STATIC_LIBS) - foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) - if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a - list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") - endif() - endforeach() - list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) - - # if pkgconfig for libsodium doesn't provide - # static lib info, then override PKG_STATIC here.. - if (sodium_PKG_STATIC_LIBRARIES STREQUAL "") + if (sodium_PKG_STATIC_LIBRARIES STREQUAL) + foreach(_libname ${sodium_PKG_STATIC_LIBRARIES}) + if (NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending with .a + list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a") + endif() + endforeach() + list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES) + else() + # if pkgconfig for libsodium doesn't provide + # static lib info, then override PKG_STATIC here.. set(sodium_PKG_STATIC_LIBRARIES libsodium.a) endif()