|
|
@@ -731,9 +731,16 @@ else ()
|
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
|
|
|
endif ()
|
|
|
if (URHO3D_LINT)
|
|
|
- # Don't show any diagnostics while in linter mode
|
|
|
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
|
|
|
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
|
|
+ find_program (CLANG_TIDY clang-tidy NO_CMAKE_FIND_ROOT_PATH)
|
|
|
+ if (CLANG_TIDY)
|
|
|
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w")
|
|
|
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
|
|
|
+ set (CMAKE_C_CLANG_TIDY ${CLANG_TIDY} -config=)
|
|
|
+ set (CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY} -config=)
|
|
|
+ set (CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
|
|
+ else ()
|
|
|
+ message (FATAL_ERROR "Ensure clang-tidy host tool is installed and can be found in the PATH environment variable.")
|
|
|
+ endif ()
|
|
|
endif ()
|
|
|
if ((NOT APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.1) OR (APPLE AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.0.0))
|
|
|
# Workaround for Clang 7.0.1 and above until the Bullet upstream has fixed the Clang 7 diagnostic checks issue (see https://github.com/bulletphysics/bullet3/issues/2114)
|
|
|
@@ -1856,26 +1863,6 @@ macro (setup_test)
|
|
|
endif ()
|
|
|
endmacro ()
|
|
|
|
|
|
-# Macro for setting up linter
|
|
|
-macro (setup_lint)
|
|
|
- if (URHO3D_LINT)
|
|
|
- find_program (CLANG_TIDY clang-tidy NO_CMAKE_FIND_ROOT_PATH)
|
|
|
- if (CLANG_TIDY)
|
|
|
- set (CMAKE_C_CLANG_TIDY ${CLANG_TIDY} -config=)
|
|
|
- set (CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY} -config=)
|
|
|
- set (CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
|
|
- else ()
|
|
|
- message (FATAL_ERROR "Ensure clang-tidy host tool is installed and can be found in the PATH environment variable.")
|
|
|
- endif ()
|
|
|
- endif ()
|
|
|
-endmacro ()
|
|
|
-
|
|
|
-# Macro for resetting the linter (intended to be called in a child scope where its parent scope has the linter setup)
|
|
|
-macro (reset_lint)
|
|
|
- unset (CMAKE_CXX_CLANG_TIDY)
|
|
|
- unset (CMAKE_EXPORT_COMPILE_COMMANDS)
|
|
|
-endmacro ()
|
|
|
-
|
|
|
# Set common binary output directory if not already set (note that this module can be included in an external project which may already have DEST_RUNTIME_DIR preset)
|
|
|
if (NOT DEST_RUNTIME_DIR)
|
|
|
set_output_directories (${CMAKE_BINARY_DIR}/bin RUNTIME PDB)
|