Need run-time option to disable use of CMAKE_{START,END}_TEMP_FILE
In a stock install of CMake, using (for example) the "NMake Makefiles" generator, building with nmake VERBOSE=1
yields output like the following:
Scanning dependencies of target pcre
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\pcre.dir\build.make /nologo -L CMakeFiles\pcre.dir\build
[ 1%] Building C object CMakeFiles/pcre.dir/pcre_byte_order.c.obj
C:\PROGRA~2\INTELS~1\COMPIL~1.281\windows\bin\intel64\icl.exe @C:\Users\cport\AppData\Local\Temp\nmCC7D.tmp
pcre_byte_order.c
Command-line warning #1678: cannot enable speculation unless fenv_access and exception_semantics are disabled
C:\tmp\pcre-8.43\pcre_byte_order.c(108): remark #15009: pcre_pattern_to_host_byte_order has been targeted for automatic cpu dispatch
[ 2%] Building C object CMakeFiles/pcre.dir/pcre_chartables.c.obj
Most of the compiler command line is hidden in a temporary response file. This makes the build robust to overly long command lines (I forget what the length limit is on Windows but it's pretty meager compared to Linux), but it hides the kind of information that you generally want to see in a build log (like exactly what options were passed to the compiler). This is especially important in my use case, which involves archiving the build log for possible future auditing.
Now, if I edit the Modules/Platform/Windows.cmake
file, and comment out the following section...
if(CMAKE_GENERATOR MATCHES "NMake")
set(CMAKE_START_TEMP_FILE "@<<\n")
set(CMAKE_END_TEMP_FILE "\n<<")
endif()
...then nmake VERBOSE=1
reports the full command line:
Scanning dependencies of target pcre
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\pcre.dir\build.make /nologo -L CMakeFiles\pcre.dir\build
[ 1%] Building C object CMakeFiles/pcre.dir/pcre_byte_order.c.obj
C:\PROGRA~2\INTELS~1\COMPIL~1.281\windows\bin\intel64\icl.exe /nologo -DHAVE_CONFIG_H -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -IC:\tmp\pcre-8.43\_build-optim -IC:\tmp\pcre-8.43 -fp:strict -GF- -Qfp-speculation:safe -O2 -Z7 -MT -W3 -Wp64 -GS -Qstd=c99 -QaxCORE-AVX2 /DWIN32 /D_WINDOWS /W3 /FoCMakeFiles\pcre.dir\pcre_byte_order.c.obj /FdCMakeFiles\pcre.dir\pcre.pdb -c C:\tmp\pcre-8.43\pcre_byte_order.c
pcre_byte_order.c
Command-line warning #1678: cannot enable speculation unless fenv_access and exception_semantics are disabled
C:\tmp\pcre-8.43\pcre_byte_order.c(108): remark #15009: pcre_pattern_to_host_byte_order has been targeted for automatic cpu dispatch
[ 2%] Building C object CMakeFiles/pcre.dir/pcre_chartables.c.obj
That's what I want to see, and I'm willing to risk breakage with overlong command lines to get this information.
The problem is, getting this type of output requires modifying the CMake installation, which poses the following issues:
-
The CMake install may be managed by someone else, who would frown on me making random edits therein;
-
The install may be a system package, in which case modifying it is completely off the table;
-
Modifying the file results in a change of behavior for all users, including users who may expect and rely upon the default behavior;
-
Locally overriding the
Windows.cmake
script in some manner is at worse complex and error-prone, and at best a significant break in abstraction.
Thus I would like to request some method, be it a command-line option, or (more likely) some variable I can set with -D
in the initial CMake invocation, to tell CMake not to make use of response files so that a verbose build log shows the complete tool invocations.
This should probably address not just NMake, but any tool which makes use of CMAKE_{START,END}_TEMP_FILE
.
Related: Issue #12658