Skip to content

Commit 481cc3f

Browse files
minrkbluca
authored andcommitted
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
1 parent ff231d2 commit 481cc3f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

CMakeLists.txt

+10-4
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,13 @@ endif()
258258
# Select curve encryption library, defaults to disabled To use libsodium instead, use --with-libsodium(must be
259259
# installed) To disable curve, use --disable-curve
260260

261-
option(WITH_LIBSODIUM "Use libsodium" OFF)
261+
option(WITH_LIBSODIUM "Use libsodium (required with ENABLE_CURVE)" OFF)
262262
option(WITH_LIBSODIUM_STATIC "Use static libsodium library" OFF)
263263
option(ENABLE_LIBSODIUM_RANDOMBYTES_CLOSE "Automatically close libsodium randombytes. Not threadsafe without getrandom()" ON)
264264
option(ENABLE_CURVE "Enable CURVE security" OFF)
265265

266266
if(ENABLE_CURVE)
267+
# libsodium is currently the only CURVE provider
267268
if(WITH_LIBSODIUM)
268269
find_package("sodium")
269270
if(SODIUM_FOUND)
@@ -280,12 +281,17 @@ if(ENABLE_CURVE)
280281
endif()
281282
else()
282283
message(
283-
ERROR
284-
"libsodium not installed, you may want to install libsodium and run cmake again"
284+
FATAL_ERROR
285+
"libsodium requested but not found, you may want to install libsodium and run cmake again"
285286
)
286287
endif()
288+
else() # WITH_LIBSODIUM
289+
message(
290+
FATAL_ERROR
291+
"ENABLE_CURVE set, but not WITH_LIBSODIUM. No CURVE provider found."
292+
)
287293
endif()
288-
else()
294+
else() # ENABLE_CURVE
289295
message(STATUS "CURVE security is disabled")
290296
endif()
291297

0 commit comments

Comments
 (0)