diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2025-12-23 11:59:45 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-01-07 10:00:06 +0100 |
| commit | 48c294105f5123dc876fbad199ec1e0166d82a18 (patch) | |
| tree | c49ce8ac75a7d63c10ea1ff960eeff750c680a8e /cmake/dependencies/sysrandom.cmake | |
| parent | 145be13e8c18fcb39476d8f65fed23d82320f22f (diff) | |
| download | ouroboros-48c294105f5123dc876fbad199ec1e0166d82a18.tar.gz ouroboros-48c294105f5123dc876fbad199ec1e0166d82a18.zip | |
build: Refactor CMake modules
This moves the CMake build logic out of the source tree and splits it
up into a more modular form. The tests now have a CMakeLists.txt file
in their respective source directory.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'cmake/dependencies/sysrandom.cmake')
| -rw-r--r-- | cmake/dependencies/sysrandom.cmake | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmake/dependencies/sysrandom.cmake b/cmake/dependencies/sysrandom.cmake new file mode 100644 index 00000000..972db801 --- /dev/null +++ b/cmake/dependencies/sysrandom.cmake @@ -0,0 +1,21 @@ +if (APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(SYS_RND_HDR "") +else () + find_path(SYS_RND_HDR sys/random.h PATH /usr/include/ /usr/local/include/) + if (SYS_RND_HDR) + message(STATUS "Found sys/random.h in ${SYS_RND_HDR}") + set(HAVE_SYS_RANDOM TRUE) + else () + set(SYS_RND_HDR "") + unset(HAVE_SYS_RANDOM) + endif () +endif() + +# Validate that at least one secure random generator is available +if (NOT ((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR APPLE OR + HAVE_SYS_RANDOM OR HAVE_OPENSSL_RNG OR HAVE_LIBGCRYPT)) + message(FATAL_ERROR "No secure random generator found, " + "please install libgcrypt (> 1.7.0) or OpenSSL") +endif () + +mark_as_advanced(SYS_RND_HDR) |
