Skip to content

Commit

Permalink
ENABLE_CLANG_TIDY option for build (#899)
Browse files Browse the repository at this point in the history
* ENABLE_CLANG_TIDY option for build

* Make clang-tidy ON by default for debug only

Co-authored-by: yiwen-wong <[email protected]>
  • Loading branch information
yiwen-wong and yiwen-wong authored Sep 1, 2021
1 parent 42df642 commit f707594
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions production/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ option(EXECUTE_FDW_TESTS "Execute FDW tests" OFF)
option(ENABLE_STACKTRACE "Enable stack traces" ON)

option(BUILD_GAIA_RELEASE "Build Gaia Release packages and binaries" OFF)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
option(ENABLE_CLANG_TIDY "Enable clang tidy" ON)
else()
option(ENABLE_CLANG_TIDY "Enable clang tidy" ON)
endif()

include(GNUInstallDirs)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
Expand Down Expand Up @@ -289,7 +296,9 @@ add_subdirectory(${GOOGLE_TEST} googletest EXCLUDE_FROM_ALL)

# Setting clang-tidy here to avoid it being applied to flatbuffers, rocksdb etc...
# TODO Maybe we could force each subproject to set this flag?
set(CMAKE_CXX_CLANG_TIDY)
if(ENABLE_CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY clang-tidy)
endif()

# Add individual component folders.
# These are listed roughly in a bottom-up order
Expand All @@ -316,7 +325,9 @@ add_subdirectory(tools)
if(BUILD_GAIA_RELEASE)
unset(CMAKE_CXX_CLANG_TIDY)
add_subdirectory("${GAIA_REPO}/third_party/production/TranslationEngineLLVM/llvm" llvm EXCLUDE_FROM_ALL)
set(CMAKE_CXX_CLANG_TIDY)
if(ENABLE_CLANG_TIDY)
set(CMAKE_CXX_CLANG_TIDY clang-tidy)
endif()
endif()

# Query processors.
Expand Down

0 comments on commit f707594

Please sign in to comment.