[CMake] file not generated with ADD_CUSTOM_COMMAND
Brad King
brad.king at kitware.com
Thu Jan 5 16:51:28 EST 2006
Alexander Neundorf wrote:
>>ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated.h
>>COMMAND sh ARGS -c "echo // >generated.h" )
>>INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR})
>>ADD_EXECUTABLE(hello main.cpp)
> And the space between the ">" and the "generated" was deadly, it
> generated a " generated.h"...
That's interesting. If I run this at the command line:
sh -c " echo // > generated.h"
I get "generated.h" but if I run this:
sh -c \ echo\ //\ >\ generated.h
I get " generated.h" even though the shell should be getting the same
arguments. Perhaps the Makefile generator should use double-quotes (or
single to avoid any expansion) to escape spaces when generating the
shell commands inside make rules on Unix. Bill, do you know if there is
a reason this won't work?
-Brad
More information about the CMake
mailing list