summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-04 14:38:58 +0200
committerSimon Rettberg2018-07-04 14:38:58 +0200
commit2e0d6c4c11de91d41e86fd8773dfb43586a19127 (patch)
treeee6fe2291dda7af5cc7d2aef16bd5ecad056c7ac
parent[SERVER] Use likely/unlikely in uplink disk writing loop (diff)
downloaddnbd3-2e0d6c4c11de91d41e86fd8773dfb43586a19127.tar.gz
dnbd3-2e0d6c4c11de91d41e86fd8773dfb43586a19127.tar.xz
dnbd3-2e0d6c4c11de91d41e86fd8773dfb43586a19127.zip
[SERVER] cmake: Add config option for extra compiler opptions
-rw-r--r--CMakeLists.txt11
1 files changed, 6 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2da9e5..ebee2cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,11 +8,12 @@ IF (CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE Debug)
ENDIF()
-SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE FILEPATH "Path prefix for system installation")
+SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Path prefix for system installation")
OPTION(BUILD_KERNEL_MODULE "Build the dnbd3 Linux kernel module" ON)
OPTION(BUILD_FUSE_CLIENT "Build dnbd3 fuse client" ON)
OPTION(BUILD_SERVER "Build dnbd3 server" ON)
OPTION(BUILD_STRESSTEST "Build dnbd3 stress testing tool" OFF)
+SET(EXTRA_C_FLAGS "" CACHE STRING "Additional options to pass to compiler")
OPTION(SERVER_FOR_AFL "Build dnbd3-server for usage with afl-fuzz" OFF)
@@ -36,12 +37,12 @@ ENDIF()
if(CMAKE_C_COMPILER MATCHES "clang")
message( "Using clang flags." )
- SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O1 -fno-omit-frame-pointer -g -Wall -Wextra -Wpedantic -Wno-unused-result -D_GNU_SOURCE -D_DEBUG -Wno-multichar -fno-strict-aliasing")
- SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar -fno-strict-aliasing")
+ SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O1 -fno-omit-frame-pointer -g -Wall -Wextra -Wpedantic -Wno-unused-result -D_GNU_SOURCE -D_DEBUG -Wno-multichar -fno-strict-aliasing ${EXTRA_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar -fno-strict-aliasing ${EXTRA_C_FLAGS}")
elseif (CMAKE_C_COMPILER MATCHES "(cc-)|(cc$)")
message( "Using (g)cc flags." )
- SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -g -Wall -Wextra -Wpedantic -Wconversion -Wno-sign-conversion -D_GNU_SOURCE -D_DEBUG -Wno-multichar -fno-strict-aliasing")
- SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar -fno-strict-aliasing")
+ SET(CMAKE_C_FLAGS_DEBUG "-std=c11 -O0 -g -Wall -Wextra -Wpedantic -Wconversion -Wno-sign-conversion -D_GNU_SOURCE -D_DEBUG -Wno-multichar -fno-strict-aliasing ${EXTRA_C_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELEASE "-std=c11 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar -fno-strict-aliasing ${EXTRA_C_FLAGS}")
else()
message( FATAL_ERROR "Could not determine compiler type." )
endif()