[cmake-developers] NMake and trailing directory separators in custom commands?

Johan Björk phb at spotify.com
Tue Jan 25 12:35:45 EST 2011


Hi everyone,

I just started using the NMake generator, and ran into an issue that
is probably trivial to fix for someone who knows the generator code.
If one of the steps for the makefile contains a trailing directory
separator, it will escape the newline and result in an invalid
command.

ie (Untested, just wrote something up that should reproduce)

ADD_CUSTOM_COMMAND(OUTPUT foo COMMAND cmake -E copy file
${CMAKE_CURRENT_LIST_DIR}/a.c ${CMAKE_BINARY_DIR}/foo/bar/). CMake
will correctly escape all the unix newlines to '\', but also the last
one, which results in NMake treating the next line as part of the
command.

Not very familiar with either Windows nor NMake, so I don't know what
the correct fix is.. Add an extra space if the last character is a \ ?

/Johan

BTW: It also happens for WORKING_DIRECTORY.



More information about the cmake-developers mailing list