I'm trying to get the exact commands that CMake invokes during the build process, specifically for clang tidy and cppcheck (using either Ninja or Makefiles).
As a result of my configuration, the compilation command for a given translation unit looks like this:
/usr/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-extra-arg=-std=gnu++20;--extra-arg-before=--driver-mode=g++" --cppcheck="/usr/bin/cppcheck;--template=gcc;--enable=style,performance,warning,portability;--inline-suppr;--suppress=internalAstError;--suppress=unmatchedSuppression;--inconclusive;--std=c++20" --source=/home/fred/code/cpp/me/cpp-template/lib/account/test/account_test.cpp -- /usr/bin/c++ -I/home/fred/code/cpp/me/cpp-template/build/_deps/catch2-src/src/catch2/.. -I/home/fred/code/cpp/me/cpp-template/build/_deps/catch2-build/generated-includes -I/home/fred/code/cpp/me/cpp-template/lib/account/include -m64 -g -std=gnu++20 -fdiagnostics-color=always --coverage -O0 -g -fsanitize=address,pointer-compare,pointer-subtract,undefined -Wall -Wextra -Wextra-semi -Wcast-align -Wdouble-promotion -Wduplicated-cond -Wduplicated-branches -Wformat=2 -Wimplicit-fallthrough -Wmisleading-indentation -Wlogical-op -Wnon-virtual-dtor -Wnull-dereference -Wold-style-cast -Wsuggest-override -Woverloaded-virtual -Wpedantic -Wshadow -Wno-sign-conversion -Wunused -Wuseless-cast -MD -MT lib/account/CMakeFiles/account_account_test.dir/test/account_test.cpp.o -MF lib/account/CMakeFiles/account_account_test.dir/test/account_test.cpp.o.d -o lib/account/CMakeFiles/account_account_test.dir/test/account_test.cpp.o -c /home/fred/code/cpp/me/cpp-template/lib/account/test/account_test.cpp
I'm getting some cppcheck errors, but I'd like to recover the exact way CMake invoked this. When I took the "CMake list" value for the arguments and pasted them together in the command line to manually run it, I was unable to reproduce the error.
How can I get CMake to output all of the exact commands it invokes during the build process (not the configure process; --trace-expand
and friends are great for that, but those didn't seem to help much)?