diff --git a/CMakeLists.txt b/CMakeLists.txt index e51373b4400..ebec245e6aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,10 +289,10 @@ Use pre-compiled headers to speed up compilation." ) mark_as_advanced(WITH_COMPILER_PRECOMPILED_HEADERS) - if(WITH_CLANG_TIDY AND CMAKE_COMPILER_IS_GNUCC) + if(WITH_CLANG_TIDY AND (CMAKE_COMPILER_IS_GNUCC OR APPLE)) if(WITH_COMPILER_PRECOMPILED_HEADERS) message(STATUS - "Clang-Tidy and GCC precompiled headers are incompatible, disabling precompiled headers" + "Clang-Tidy and the current compiler's precompiled headers are incompatible, disabling precompiled headers." ) set(WITH_COMPILER_PRECOMPILED_HEADERS OFF) endif() @@ -783,7 +783,7 @@ mark_as_advanced(WITH_ASSERT_ABORT) option(WITH_ASSERT_RELEASE "Build with asserts enabled even for non-debug configurations" OFF) mark_as_advanced(WITH_ASSERT_RELEASE) -if((UNIX AND NOT APPLE) OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+")) +if(UNIX OR (CMAKE_GENERATOR MATCHES "^Visual Studio.+")) option(WITH_CLANG_TIDY "\ Use Clang Tidy to analyze the source code \ (only enable for development on Linux using Clang, or Windows using the Visual Studio IDE)" diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index fa48d6be171..477dd7b518f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -8,9 +8,12 @@ endif() if(WITH_CLANG_TIDY AND NOT MSVC) find_package(ClangTidy REQUIRED) - set(CMAKE_C_CLANG_TIDY - ${CLANG_TIDY_EXECUTABLE};--extra-arg=-Wno-error=unknown-warning-option) - set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE};--extra-arg=-Wno-error=unknown-warning-option) + set(CLANG_TIDY_EXTRA_ARGS --extra-arg=-Wno-error=unknown-warning-option) + + set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE};${CLANG_TIDY_EXTRA_ARGS}) + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE};${CLANG_TIDY_EXTRA_ARGS}) + set(CMAKE_OBJC_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE};${CLANG_TIDY_EXTRA_ARGS}) + set(CMAKE_OBJCXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE};${CLANG_TIDY_EXTRA_ARGS}) endif() add_subdirectory(blender)