From 18a229e849b5448ed84987b35158f353cc0c72d5 Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Wed, 10 Nov 2021 13:54:25 -0700 Subject: [PATCH] Add a minimal binary to generate compile_commands.json file clang-tidy needs compile_commands.json to generate a set of source files to parse. tidy-base is not built but is used as a source file in which included headers can be parsed. Without this process, clang-tidy will process many other source files (e.g. doctest.hpp) that we do not want to worry about. Signed-off-by: Sean Robinson --- test/CMakeLists.txt | 7 +++++++ test/tidy-base.cpp | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 test/tidy-base.cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3c502d9..02572a0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -57,3 +57,10 @@ set_property(TARGET ARGPARSE PROPERTY CXX_STANDARD 17) # Set ${PROJECT_NAME} as the startup project set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ARGPARSE) + +file(GLOB ARGPARSE_LINT_SOURCES + tidy-base.cpp +) +ADD_EXECUTABLE(ARGPARSE_LINT ${ARGPARSE_LINT_SOURCES}) +set_target_properties(ARGPARSE_LINT PROPERTIES OUTPUT_NAME tidy-base) +set_property(TARGET ARGPARSE_LINT PROPERTY CXX_STANDARD 17) diff --git a/test/tidy-base.cpp b/test/tidy-base.cpp new file mode 100644 index 0000000..87b47a1 --- /dev/null +++ b/test/tidy-base.cpp @@ -0,0 +1,4 @@ + +#include "argparse/argparse.hpp" + +int main(int argc, const char* argv[]) {}