diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-04-08 20:09:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-04-13 13:56:10 (GMT) |
commit | 5e62444cff5ead280a111c116a3fe810181379cf (patch) | |
tree | 83764d54d99f246c011defdd49e0ccfa658f8fd6 /Source/cmMakefileTargetGenerator.cxx | |
parent | 9ac11bc25d6b9f5e7db786034f922d96613e6143 (diff) | |
download | CMake-5e62444cff5ead280a111c116a3fe810181379cf.zip CMake-5e62444cff5ead280a111c116a3fe810181379cf.tar.gz CMake-5e62444cff5ead280a111c116a3fe810181379cf.tar.bz2 |
Add options to run clang-tidy with the compiler
Create a <LANG>_CLANG_TIDY target property (initialized by a
CMAKE_<LANG>_CLANG_TIDY variable) to specify a clang-tidy command line
to be run along with the compiler.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index eedc6ab..29708d9 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -667,10 +667,23 @@ cmMakefileTargetGenerator { std::string const iwyu_prop = lang + "_INCLUDE_WHAT_YOU_USE"; const char *iwyu = this->GeneratorTarget->GetProperty(iwyu_prop); - if (iwyu && *iwyu) + std::string const tidy_prop = lang + "_CLANG_TIDY"; + const char *tidy = this->GeneratorTarget->GetProperty(tidy_prop); + if ((iwyu && *iwyu) || (tidy && *tidy)) { - std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu --iwyu="; - run_iwyu += this->LocalGenerator->EscapeForShell(iwyu); + std::string run_iwyu = "$(CMAKE_COMMAND) -E __run_iwyu"; + if (iwyu && *iwyu) + { + run_iwyu += " --iwyu="; + run_iwyu += this->LocalGenerator->EscapeForShell(iwyu); + } + if (tidy && *tidy) + { + run_iwyu += " --tidy="; + run_iwyu += this->LocalGenerator->EscapeForShell(tidy); + run_iwyu += " --source="; + run_iwyu += sourceFile; + } run_iwyu += " -- "; compileCommands.front().insert(0, run_iwyu); } |