clang-tidy on Windows fails with MSVC -external:I flag
We recently tried to upgrade from cmake version 3.20 to 3.22 and our builds fail when clang-tidy is being used. The version of clang-tidy is version 13.
The issue is that cmake 3.22 now passes the -externalI flag to the MS Compiler and clang-tidy doesn't know that flag so all external headers are not found. I don't have a workaround for this issue yet.
In additional it appears that clang-tidy isn't accepting the /std:c++17 flag that is passed to the MS Compiler so the wrong version of C++ is used (this is probably similar to issue #22767 but our invocation of the MSVC compiler command line has the /std:c++17 so it's not exactly the same issue). This issue was easy to fix by adding --extra-arg=/std:c++17 to the
CMAKE_CXX_CLANG_TIDY variable. This is the same solution we used to fix the issue that the flag /EHsc wasn't passed to clang-tidy (issue #20512).