0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 06:41:03 +08:00

halt build if CURVE requested but not found

ENABLE_CURVE is currently redundant with WITH_LIBSODIUM, as the only existing provider

now builds where requested configuration is not found fail rather than proceeding without requested features
This commit is contained in:
Min RK 2024-02-28 14:17:01 +01:00 committed by Luca Boccassi
parent ff231d2673
commit 481cc3fa2c

View File

@ -258,12 +258,13 @@ endif()
# Select curve encryption library, defaults to disabled To use libsodium instead, use --with-libsodium(must be # Select curve encryption library, defaults to disabled To use libsodium instead, use --with-libsodium(must be
# installed) To disable curve, use --disable-curve # installed) To disable curve, use --disable-curve
option(WITH_LIBSODIUM "Use libsodium" OFF) option(WITH_LIBSODIUM "Use libsodium (required with ENABLE_CURVE)" OFF)
option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF) option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF)
option(ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE "Automatically close libsodium randombytes. Not threadsafe without getrandom()" ON) option(ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE "Automatically close libsodium randombytes. Not threadsafe without getrandom()" ON)
option(ENABLE_CURVE "Enable CURVE security" OFF) option(ENABLE_CURVE "Enable CURVE security" OFF)
if(ENABLE_CURVE) if(ENABLE_CURVE)
# libsodium is currently the only CURVE provider
if(WITH_LIBSODIUM) if(WITH_LIBSODIUM)
find_package("sodium") find_package("sodium")
if(SODIUM_FOUND) if(SODIUM_FOUND)
@ -280,12 +281,17 @@ if(ENABLE_CURVE)
endif() endif()
else() else()
message( message(
ERROR FATAL_ERROR
"libsodium not installed, you may want to install libsodium and run cmake again" "libsodium requested but not found, you may want to install libsodium and run cmake again"
) )
endif() endif()
else() # WITH_LIBSODIUM
message(
FATAL_ERROR
"ENABLE_CURVE set, but not WITH_LIBSODIUM. No CURVE provider found."
)
endif() endif()
else() else() # ENABLE_CURVE
message(STATUS "CURVE security is disabled") message(STATUS "CURVE security is disabled")
endif() endif()