Just to add to the only answer. In case when the obj path is quoted, the trailing backslash has to be either added after the path closing quote, or escaped if added before the quote.
cl /Fo"quoted path\obj"\ -c foo.c fee.c
OR
cl "/Foquoted path\obj"\ -c foo.c fee.c
OR
cl /Fo"quoted path\obj\\" -c foo.c fee.c
Speaking of NMAKE
, similar syntax is expected when passing quoted macro values on NMAKE
command line. The trailing backslash seems to be the crucial bit to watch for.
nmake SOMEDIR="quoted path\obj"\
OR
nmake SOMEDIR="quoted path\obj\\"
OR
nmake "SOMEDIR=quoted path\obj"
NOT
nmake SOMEDIR="quoted path\obj\"
as this would result in an escaped quote \"
and would grab whatever else followed on the command line and put it into $(SOMEDIR)
. Took me a while to diagnose such a behavior, hope this would save time to someone else.