CMake 3.20 regression with NMakefile dependency-generation on Windows
Hi, I'm not very familiar with CMake, so please accept any mistakes I make with terminology etc.
There appears to be a problem with the filenames that get written to compiler_depend.make
when creating "NMake Makefiles" using cmake 3.20.0 on Windows. This problem was first actually spotted with cmake 3.20.0-rc1 (see https://github.com/raspberrypi/pico-sdk/issues/169 ) but I'm afraid I didn't report it as a cmake bug, as I assumed it was "fairly obvious" and would get fixed during the RC-phase. However I just checked and it's still present in the cmake 3.20.0 that I downloaded today. Apologies, mea culpa. (Also, I run Linux on all my PCs, and so only rarely load up Windows inside a VM for testing purposes)
To reproduce, follow section 9.2 of https://datasheets.raspberrypi.org/pico/getting-started-with-pico.pdf using CMake 3.20.0 (I'm not the author of these CMakeFiles, so I dunno if there's an easier way to reproduce).
The first nmake
works fine, but if you try to run nmake
a second time you get errors like:
blink\CMakeFiles\blink.dir\compiler_depend.make(4) : fatal error U1033: syntax error : ':' unexpected
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\.....\x86\nmake.exe"' : return code '0x2'
Stop.
(With a fresh build directory, running nmake
twice in a row works fine when using cmake 3.19.7 on Windows)
The problem seems to be that the compiler_depend.cmake
files contains lines looking like:
# CMAKE generated file: DO NOT EDIT!
# Generated by "NMake Makefiles" Generator, CMake Version 3.20
blink\CMakeFiles\blink.dir\C_\Users\IEUser\Downloads\pico-sdk\src\common\pico_sync\critical_section.c.obj: C:\Users\IEUser\Downloads\pico-sdk\src\common\pico_sync\critical_section.c
blink\CMakeFiles\blink.dir\C_\Users\IEUser\Downloads\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\Users\IEUser\Downloads\pico-sdk\src\common\pico_sync\critical_section.c
blink\CMakeFiles\blink.dir\C_\Users\IEUser\Downloads\pico-sdk\src\common\pico_sync\critical_section.c.obj: C\:\Users\IEUser\Downloads\pico-sdk\src\common\pico_sync\include\pico\critical_section.h
and it appears to be the C\:\
that is tripping up nmake.
If there's any other info I can provide to help, please let me know!