The compiler (CL.EXE) can take multiple source files, but likes to generate all the OBJ files in the directory that it is invoked. I couldn't find the compiler flag to set an output directory but I did find one for an individual OBJ, but it can't take multiple sources.
Without having to specify each file to redirect the output and having lots of targets for NMAKE, is there an easy way to do it through CL?
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.
OR
OR
Speaking of
NMAKE
, similar syntax is expected when passing quoted macro values onNMAKE
command line. The trailing backslash seems to be the crucial bit to watch for.OR
OR
NOT
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.It turns out the
/Fo
option actually works, but the directory you specify must end with a backslash. ThusWorks but
cl /Fo.\obj -c ...
would fail.