So response files are being used by default to specify the command line switches to the compiler and linker for some toolchains. This appears to apply only to makefiles, though. Arguably this is done to get around the 8192 character length limit for command lines on Windows, given my scenario with the NMake Makefiles
generator.
Apparently the settings are supposed to be governed by CMAKE_<LANG>_USE_RESPONSE_FILE_FOR_OBJECTS
which isn't exactly documented as far as I could find it. Anyway, various CMake scripts that come with the CMake (3.15.1) distribution contain either 0 or 1 for these settings (i.e. per language <LANG>
). The only place where this appears to be read is cmMakefileTargetGenerator::CheckUseResponseFileForObjects()
in cmMakefileTargetGenerator.cxx
(as of this writing).
Complementary settings exist in the form of CMAKE_<LANG>_USE_RESPONSE_FILE_FOR_INCLUDES
and CMAKE_<LANG>_USE_RESPONSE_FILE_FOR_LIBRARIES
.
Now while this technically works it really causes one undesired side effect for me. In the logs from automated builds I'd like to see what was happening (yep, I am also setting CMAKE_VERBOSE_MAKEFILE=ON
). Given the fact that these response files are being generated on the fly, the command lines I get to see from the log file look akin to:
C:\PROGRA~2\MICROS~1\2019\PROFES~1\VC\Tools\MSVC\1422~1.279\bin\Hostx86\x86\cl.exe @C:\Users\XA1DB~1.RLM\AppData\Local\Temp\nm2A99.tmp
This means I no longer get to see what arguments are being passed. The output essentially becomes becomes useless for my purposes.
How can I get CMake to generate makefiles that will also show me the contents of the response files in-line, so that I may glean the compiler/linker command line arguments from a build log?
NB: don't get me wrong, I fully appreciate the existing limitation on Windows. However, even if the actual call to invoke the compiler or linker uses response files, I'd simply like to see the response file contents instead of the response file names. I am looking for a canonical way of doing this, without having to conjure up some hacky solution that will break the next time CMake gets an update to its internals.
I also found it a bit worrying to see 8.3 (alternative) path names names used in 2019 (given fsutil behavior set disable8dot3 1
/ NtfsDisable8dot3NameCreation
), but perhaps the CMake authors have insights I don't have. I was unable to find any setting to configure that behavior in the most recent source code from the Git repo.