Skip to content

Use --driver-mode=cl if necessary when running iwyu.

zjturner requested to merge zjturner/cmake:master into master

When using -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE CMake shells out to the include-what-you-use tool by building up a command line consisting of

a) the include-what-you-use executable

followed by

b) all of the arguments that CMake would normally pass to CMAKE_CXX_COMPILER.

However, if CMAKE_CXX_COMPILER is clang-cl instead of clang, then the driver parses command line options differently. Since we're not invoking the cxx compiler directly, and since we don't pass any other information to the include-what-you-use tool to allow it to determine what kind of compiler we're using, we need to use the same logic that clang-cl itself uses (namely to look at the name of the executable program) and manually stick the driver mode on to the command line when necessary.

Merge request reports