diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-02-04 18:41:34 -0800 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2017-02-09 09:21:02 +0100 |
commit | fce9382b4b99178fdbd188bec098b9b085327fef (patch) | |
tree | 2097e58e5fed18f5580d000fe5d5dcf26161e251 /CMakeLists.txt | |
parent | ac2d43e7c84fa3041ee2bf5709fdf69352189317 (diff) | |
download | ubox-fce9382b4b99178fdbd188bec098b9b085327fef.tar.gz |
cmake: Check for getrandom system call
In case we are building against a kernel that is too old and does not
support SYS_getrandom, error out with a message indicating so.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cf0c93..9033493 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,10 +16,17 @@ IF(DEBUG) ADD_DEFINITIONS(-DDEBUG -g3) ENDIF() -ADD_EXECUTABLE(getrandom getrandom.c) -INSTALL(TARGETS getrandom - RUNTIME DESTINATION bin -) +INCLUDE (CheckSymbolExists) +CHECK_SYMBOL_EXISTS(SYS_getrandom sycall.h getrandom) + +IF(getrandom) + ADD_EXECUTABLE(getrandom getrandom.c) + INSTALL(TARGETS getrandom + RUNTIME DESTINATION bin + ) +ELSE() + message( FATAL_ERROR "Kernel too old, missing SYS_getrandom system call") +ENDIF() ADD_EXECUTABLE(kmodloader kmodloader.c) TARGET_LINK_LIBRARIES(kmodloader ubox) |