summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-03-05 10:09:30 +0100
committerSimon Rettberg2021-03-05 10:36:39 +0100
commit8fa0cb60b98e174375118f666f622bb627e93f66 (patch)
tree047800727e14e8e8bbb914f0b3e136b0e11f17ec
parent[BUILD] Add support in CMake to validate (lint) the source code (diff)
downloaddnbd3-8fa0cb60b98e174375118f666f622bb627e93f66.tar.gz
dnbd3-8fa0cb60b98e174375118f666f622bb627e93f66.tar.xz
dnbd3-8fa0cb60b98e174375118f666f622bb627e93f66.zip
[BUILD] Make lint/format optional
-rw-r--r--CMakeLists.txt14
1 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb4d5d1..7ecefc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,7 @@ OPTION(DNBD3_SERVER_DEBUG_LOCKS "Add lock debugging code to dnbd3-server" OFF)
OPTION(DNBD3_SERVER_DEBUG_THREADS "Add thread debugging code to dnbd3-server" OFF)
OPTION(DNBD3_RELEASE_HARDEN "Compile dnbd3 programs in Release build with code hardening options" OFF)
OPTION(DNBD3_PACKAGE_DOCKER "Enable packaging of Docker image" OFF)
+OPTION(DNBD3_LINT "Enable source code linting and formatting with clang-format" OFF)
# set supported build configurations
set(CMAKE_CONFIGURATION_TYPES Debug Release)
@@ -37,7 +38,18 @@ find_package(Threads REQUIRED)
# include project version and build type related macros
include(Version)
include(Build)
-include(Lint)
+if(DNBD3_LINT)
+ include(Lint)
+else()
+ macro(add_linter LINT_NAME LINT_SOURCE_FILES)
+ endmacro()
+ macro(add_linter_fix LINT_NAME LINT_SOURCE_FILES)
+ endmacro()
+ macro(add_kernel_linter LINT_NAME LINT_SOURCE_FILES)
+ endmacro()
+ macro(add_kernel_linter_fix LINT_NAME LINT_SOURCE_FILES)
+ endmacro()
+endif(DNBD3_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")