-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#.rst: | ||
# FindClangTidy | ||
# ------------- | ||
# Finds clang-tidy and sets it up to run along with the compiler for C and CXX. | ||
|
||
find_program(CLANG_TIDY_EXECUTABLE clang-tidy) | ||
|
||
if(CLANG_TIDY_EXECUTABLE) | ||
execute_process(COMMAND "${CLANG_TIDY_EXECUTABLE}" --version | ||
OUTPUT_VARIABLE CLANG_TIDY_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
string(REGEX MATCH "[^\n]* version [^\n]*" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}") | ||
string(REGEX REPLACE ".* version (.*)" "\\1" CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION}") | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(ClangTidy REQUIRED_VARS CLANG_TIDY_EXECUTABLE | ||
VERSION_VAR CLANG_TIDY_VERSION) | ||
|
||
if(CLANGTIDY_FOUND) | ||
# Supports Unix Makefiles and Ninja | ||
set(CMAKE_C_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE) | ||
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}" PARENT_SCOPE) | ||
endif() | ||
|
||
mark_as_advanced(CLANG_TIDY_EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters