Expat: build on older GLibC versions

getrandom() is only in GLibC >= 2.2.5, and CentOS 7 uses an older
GCC version, so add CMake logic to fallback to /dev/urandom as the
Expat entroy source.
next
James Turner 3 years ago
parent 7ee427c202
commit 6b9575d076

@ -1,7 +1,21 @@
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(HAVE_GETRANDOM YES)
check_cxx_source_compiles(
"#include <sys/random.h>
int main(void) {
return 0;
}
"
HAVE_GETRANDOM)
if (NOT HAVE_GETRANDOM)
# on older (GLibC < 2.25) fall back to /dev/urandom
set(XML_DEV_URANDOM 1)
else()
message(STATUS "Found <sys/random.h>")
endif()
endif()
configure_file (
"${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in"
"${PROJECT_BINARY_DIR}/3rdparty/expat/simgear_expat_config.h"

@ -11,6 +11,7 @@
#endif
#cmakedefine HAVE_GETRANDOM
#cmakedefine XML_DEV_URANDOM
// we can assume > 10.7 macOS so always set this
#ifdef __APPLE__

Loading…
Cancel
Save