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 /Tests/RunCMake/ClangTidy | |
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 'Tests/RunCMake/ClangTidy')
-rw-r--r-- | Tests/RunCMake/ClangTidy/C-Build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/C-launch-Build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/C-launch.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/C.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/CXX-Build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/CXX-launch-Build-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/CXX-launch.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/CXX.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/RunCMakeTest.cmake | 22 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/main.c | 1 | ||||
-rw-r--r-- | Tests/RunCMake/ClangTidy/main.cxx | 1 |
12 files changed, 43 insertions, 0 deletions
diff --git a/Tests/RunCMake/ClangTidy/C-Build-stdout.txt b/Tests/RunCMake/ClangTidy/C-Build-stdout.txt new file mode 100644 index 0000000..a47a2de --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.c:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/C-launch-Build-stdout.txt b/Tests/RunCMake/ClangTidy/C-launch-Build-stdout.txt new file mode 100644 index 0000000..a47a2de --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C-launch-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.c:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/C-launch.cmake b/Tests/RunCMake/ClangTidy/C-launch.cmake new file mode 100644 index 0000000..e66ca20 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C.cmake) diff --git a/Tests/RunCMake/ClangTidy/C.cmake b/Tests/RunCMake/ClangTidy/C.cmake new file mode 100644 index 0000000..b8057b0 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/C.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +add_executable(main main.c) diff --git a/Tests/RunCMake/ClangTidy/CMakeLists.txt b/Tests/RunCMake/ClangTidy/CMakeLists.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/ClangTidy/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/ClangTidy/CXX-Build-stdout.txt b/Tests/RunCMake/ClangTidy/CXX-Build-stdout.txt new file mode 100644 index 0000000..47e43af --- /dev/null +++ b/Tests/RunCMake/ClangTidy/CXX-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.cxx:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/CXX-launch-Build-stdout.txt b/Tests/RunCMake/ClangTidy/CXX-launch-Build-stdout.txt new file mode 100644 index 0000000..47e43af --- /dev/null +++ b/Tests/RunCMake/ClangTidy/CXX-launch-Build-stdout.txt @@ -0,0 +1 @@ +Tests[/\]RunCMake[/\]ClangTidy[/\]main\.cxx:0:0: warning: message \[checker\] diff --git a/Tests/RunCMake/ClangTidy/CXX-launch.cmake b/Tests/RunCMake/ClangTidy/CXX-launch.cmake new file mode 100644 index 0000000..3002c9d --- /dev/null +++ b/Tests/RunCMake/ClangTidy/CXX-launch.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX.cmake) diff --git a/Tests/RunCMake/ClangTidy/CXX.cmake b/Tests/RunCMake/ClangTidy/CXX.cmake new file mode 100644 index 0000000..2d22325 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/CXX.cmake @@ -0,0 +1,3 @@ +enable_language(CXX) +set(CMAKE_CXX_CLANG_TIDY "${PSEUDO_TIDY}" -some -args) +add_executable(main main.cxx) diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake new file mode 100644 index 0000000..27cd922 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake @@ -0,0 +1,22 @@ +include(RunCMake) + +set(RunCMake_TEST_OPTIONS "-DPSEUDO_TIDY=${PSEUDO_TIDY}") + +function(run_tidy lang) + # Use a single build tree for tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${lang}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${lang}) + + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${lang}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_tidy(C) +run_tidy(CXX) +if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_tidy(C-launch) + run_tidy(CXX-launch) +endif() diff --git a/Tests/RunCMake/ClangTidy/main.c b/Tests/RunCMake/ClangTidy/main.c new file mode 100644 index 0000000..78f2de1 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/main.c @@ -0,0 +1 @@ +int main(void) { return 0; } diff --git a/Tests/RunCMake/ClangTidy/main.cxx b/Tests/RunCMake/ClangTidy/main.cxx new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/Tests/RunCMake/ClangTidy/main.cxx @@ -0,0 +1 @@ +int main() { return 0; } |