diff options
author | Brad King <brad.king@kitware.com> | 2023-05-18 13:24:01 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-05-18 13:24:17 (GMT) |
commit | 4d5c32fa2cd0170617d1ab489b17ec7fee87b89d (patch) | |
tree | 62d181c52c9750f9dfce98765f1f029762afa277 /Tests/RunCMake | |
parent | b6c45d28b2e2cd45fe69fc68c6ca2f1fefe9afd9 (diff) | |
parent | 775c369420ece1500c2de46b83d5564480d05f70 (diff) | |
download | CMake-4d5c32fa2cd0170617d1ab489b17ec7fee87b89d.zip CMake-4d5c32fa2cd0170617d1ab489b17ec7fee87b89d.tar.gz CMake-4d5c32fa2cd0170617d1ab489b17ec7fee87b89d.tar.bz2 |
Merge topic 'skip-linting'
775c369420 Autogen: set SKIP_LINTING ON for generated files
b480315e0c TargetGenerator: Add SKIP_LINTING source property
993dde925f TargetGenerator: Factor out generation of code check rules
023af4ab2f Improve Const Correctness
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8467
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/AutogenSkipLinting.cmake | 16 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/RunCMakeTest.cmake | 15 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/SkipLinting.cxx | 6 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/SkipLinting.h | 11 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/CMakeLists copy.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/MultiLint/RunCMakeTest.cmake | 19 |
16 files changed, 111 insertions, 0 deletions
diff --git a/Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt b/Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/Autogen/AutogenSkipLinting-build-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/Autogen/AutogenSkipLinting.cmake b/Tests/RunCMake/Autogen/AutogenSkipLinting.cmake new file mode 100644 index 0000000..3ce2092 --- /dev/null +++ b/Tests/RunCMake/Autogen/AutogenSkipLinting.cmake @@ -0,0 +1,16 @@ +enable_language(CXX) + +find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<1:${PSEUDO_IWYU}>" -some -args) +set(CMAKE_CXX_CLANG_TIDY "$<1:${PSEUDO_TIDY}>" -bad) +set(CMAKE_CXX_CPPLINT "$<1:${PSEUDO_CPPLINT}>" --error) +set(CMAKE_CXX_CPPCHECK "$<1:${PSEUDO_CPPCHECK}>" -error) + +add_executable(SkipLinting SkipLinting.cxx SkipLinting.h) +set_source_files_properties(SkipLinting.cxx PROPERTIES SKIP_LINTING TRUE) + +target_link_libraries(SkipLinting Qt${with_qt_version}::Core + Qt${with_qt_version}::Widgets + Qt${with_qt_version}::Gui) diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake index 4505132..97b64ed 100644 --- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake @@ -87,5 +87,20 @@ if (DEFINED with_qt_version) message(STATUS "RunCMake_TEST_EXPECT_stdout: ${RunCMake_TEST_EXPECT_stdout}") run_cmake_command(AutogenUseSystemIncludeOff ${CMAKE_COMMAND} --build . --config Debug --verbose) endblock() + + if(RunCMake_GENERATOR MATCHES "Make|Ninja") + block() + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutogenSkipLinting-build) + list(APPEND RunCMake_TEST_OPTIONS + "-DPSEUDO_CPPCHECK=${PSEUDO_CPPCHECK}" + "-DPSEUDO_CPPLINT=${PSEUDO_CPPLINT}" + "-DPSEUDO_IWYU=${PSEUDO_IWYU}" + "-DPSEUDO_TIDY=${PSEUDO_TIDY}") + + run_cmake(AutogenSkipLinting) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(AutogenSkipLinting-build ${CMAKE_COMMAND} --build . --config Debug --verbose) + endblock() + endif() endif() endif () diff --git a/Tests/RunCMake/Autogen/SkipLinting.cxx b/Tests/RunCMake/Autogen/SkipLinting.cxx new file mode 100644 index 0000000..9e09b27 --- /dev/null +++ b/Tests/RunCMake/Autogen/SkipLinting.cxx @@ -0,0 +1,6 @@ +#include "SkipLinting.h" + +int main() +{ + return 0; +} diff --git a/Tests/RunCMake/Autogen/SkipLinting.h b/Tests/RunCMake/Autogen/SkipLinting.h new file mode 100644 index 0000000..def56a0 --- /dev/null +++ b/Tests/RunCMake/Autogen/SkipLinting.h @@ -0,0 +1,11 @@ +#ifndef SKIP_LINTING_H +#define SKIP_LINTING_H + +#include <QObject> + +class SkipMe : public QObject +{ + Q_OBJECT +}; + +#endif diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index e87239e..3997a74 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -266,6 +266,10 @@ if(CMake_TEST_Qt6 AND Qt6Widgets_FOUND) -Dwith_qt_version=6 "-DQt6_DIR:PATH=${Qt6_DIR}" "-DCMAKE_PREFIX_PATH:STRING=${base_dir}" + -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy> + -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu> + -DPSEUDO_CPPLINT=$<TARGET_FILE:pseudo_cpplint> + -DPSEUDO_CPPCHECK=$<TARGET_FILE:pseudo_cppcheck> ) set(want_NoQt_test FALSE) endif () diff --git a/Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake new file mode 100644 index 0000000..d0d9866 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C-launch_skip_linting_ON.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(C_skip_linting_ON.cmake) diff --git a/Tests/RunCMake/MultiLint/CMakeLists copy.txt b/Tests/RunCMake/MultiLint/CMakeLists copy.txt new file mode 100644 index 0000000..93ee9df --- /dev/null +++ b/Tests/RunCMake/MultiLint/CMakeLists copy.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake new file mode 100644 index 0000000..6347e60 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX-launch_skip_linting_ON.cmake @@ -0,0 +1,3 @@ +set(CTEST_USE_LAUNCHERS 1) +include(CTestUseLaunchers) +include(CXX_skip_linting_ON.cmake) diff --git a/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt new file mode 100644 index 0000000..3beecb0 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF-Build-result.txt @@ -0,0 +1 @@ +(1|2) diff --git a/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake new file mode 100644 index 0000000..a0311a6 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX_skip_linting_OFF.cmake @@ -0,0 +1,7 @@ +enable_language(CXX) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<1:${PSEUDO_IWYU}>" -some -args) +set(CMAKE_CXX_CLANG_TIDY "$<1:${PSEUDO_TIDY}>" -bad) +set(CMAKE_CXX_CPPLINT "$<1:${PSEUDO_CPPLINT}>" --error) +set(CMAKE_CXX_CPPCHECK "$<1:${PSEUDO_CPPCHECK}>" -error) +add_executable(main main.cxx) +set_source_files_properties(main.cxx PROPERTIES SKIP_LINTING OFF) diff --git a/Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake new file mode 100644 index 0000000..39cfe87 --- /dev/null +++ b/Tests/RunCMake/MultiLint/CXX_skip_linting_ON.cmake @@ -0,0 +1,7 @@ +enable_language(CXX) +set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "$<1:${PSEUDO_IWYU}>" -some -args) +set(CMAKE_CXX_CLANG_TIDY "$<1:${PSEUDO_TIDY}>" -bad) +set(CMAKE_CXX_CPPLINT "$<1:${PSEUDO_CPPLINT}>" --error) +set(CMAKE_CXX_CPPCHECK "$<1:${PSEUDO_CPPCHECK}>" -error) +add_executable(main main.cxx) +set_source_files_properties(main.cxx PROPERTIES SKIP_LINTING ON) diff --git a/Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt b/Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt new file mode 100644 index 0000000..3beecb0 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C_skip_linting_OFF-Build-result.txt @@ -0,0 +1 @@ +(1|2) diff --git a/Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake b/Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake new file mode 100644 index 0000000..2968a21 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C_skip_linting_OFF.cmake @@ -0,0 +1,7 @@ +enable_language(C) +set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad) +set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --error) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -error) +add_executable(main main.c) +set_source_files_properties(main.c PROPERTIES SKIP_LINTING OFF) diff --git a/Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake b/Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake new file mode 100644 index 0000000..09fc761 --- /dev/null +++ b/Tests/RunCMake/MultiLint/C_skip_linting_ON.cmake @@ -0,0 +1,7 @@ +enable_language(C) +set(CMAKE_C_INCLUDE_WHAT_YOU_USE "${PSEUDO_IWYU}" -some -args) +set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad) +set(CMAKE_C_CPPLINT "${PSEUDO_CPPLINT}" --error) +set(CMAKE_C_CPPCHECK "${PSEUDO_CPPCHECK}" -error) +add_executable(main main.c) +set_source_files_properties(main.c PROPERTIES SKIP_LINTING ON) diff --git a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake index afd98fd..9b7a6a9 100644 --- a/Tests/RunCMake/MultiLint/RunCMakeTest.cmake +++ b/Tests/RunCMake/MultiLint/RunCMakeTest.cmake @@ -25,3 +25,22 @@ if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") run_multilint(C-launch) run_multilint(CXX-launch) endif() + +function(run_skip_linting test_name) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${test_name}-build") + set(RunCMake_TEST_NO_CLEAN 1) + + run_cmake(${test_name}) + set(RunCMake_TEST_OUTPUT_MERGE 1) + run_cmake_command(${test_name}-Build ${CMAKE_COMMAND} --build .) +endfunction() + +run_skip_linting(C_skip_linting_ON) +run_skip_linting(CXX_skip_linting_ON) +run_skip_linting(C_skip_linting_OFF) +run_skip_linting(CXX_skip_linting_OFF) + +if(NOT RunCMake_GENERATOR STREQUAL "Watcom WMake") + run_skip_linting(C-launch_skip_linting_ON) + run_skip_linting(CXX-launch_skip_linting_ON) +endif() |