summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorManuel Bentele2021-08-25 11:44:03 +0200
committerManuel Bentele2021-08-25 11:44:03 +0200
commit118a5c5311e8acd7c85d0f353b5bd4251b6306b2 (patch)
tree17a36e8cd831b8dd7a297f0d4fb5ab8549865c06 /CMakeLists.txt
parent[SERVER] Make default config a bit more readable (diff)
downloaddnbd3-118a5c5311e8acd7c85d0f353b5bd4251b6306b2.tar.gz
dnbd3-118a5c5311e8acd7c85d0f353b5bd4251b6306b2.tar.xz
dnbd3-118a5c5311e8acd7c85d0f353b5bd4251b6306b2.zip
[BUILD] Fix CMake output if kernel module is turned off on Linux system
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 9 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4047d14..cf11744 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,18 +41,21 @@ include(Build)
include(Lint)
# check for system and enable or disable built of Linux kernel module
-if(DNBD3_KERNEL_MODULE AND UNIX AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
+ # disable build of the dnbd3 Linux kernel module on a system other than Linux, eg. FreeBSD
+ message(STATUS "Detected non-Linux system: Disable build of the dnbd3 Linux kernel module")
+ set(DNBD3_KERNEL_MODULE OFF)
+endif(NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
+
+# enable or disable requirements for a built of the Linux kernel module
+if(DNBD3_KERNEL_MODULE)
# require Linux kernel headers
find_package(KernelHeaders REQUIRED)
# print configured settings
message(STATUS "Path to Linux kernel modules to compile against is " ${KERNEL_BUILD_DIR})
message(STATUS "Path to install Linux kernel modules is " ${KERNEL_INSTALL_DIR})
-else(DNBD3_KERNEL_MODULE AND UNIX AND CMAKE_SYSTEM_NAME MATCHES "Linux")
- # disable build of the dnbd3 Linux kernel module on a system other than Linux, eg. FreeBSD
- message(STATUS "Detected non-Linux system: Disable build of the dnbd3 Linux kernel module")
- set(DNBD3_KERNEL_MODULE OFF)
-endif(DNBD3_KERNEL_MODULE AND UNIX AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+endif(DNBD3_KERNEL_MODULE)
# set include directories
set(PROJECT_GEN_DIR ${CMAKE_BINARY_DIR}/generated)