[CMake] custom target not working on windows
Tyler Roscoe
tyler at cryptio.net
Fri Jul 31 11:01:59 EDT 2009
On Fri, Jul 31, 2009 at 08:42:10AM -0400, Marc Schafer wrote:
> add_custom_target ( generated_messages ALL
> COMMAND
> ${ANT_EXECUTABLE} -f ${PROJECT_SOURCE_DIR}/java/MessageGenerator/build.xml
> run
> COMMAND
> ${CMAKE_COMMAND} -E copy_if_different ${DICTIONARY_DIR}/c/messages.h
> ${PROJECT_BINARY_DIR}/include/messages.h
> )
>
> This works fine on Linux and Mac with the make generator but does not work
> on Windows XP with the Visual studio 2008 generator. From the build log
> file, I can see that a batch file is getting generated with two commands:
> one to run ant and the other to do the copy. When the batch file is run,
> the ant command works fine, but the copy never seems to happen. My library
> fails to build because it can't find messages.h even though it does exist in
> ${DICTIONARY_DIR}/c/messages.h
I have run into this. Here's a note from our (internal) wiki:
"If invoking a DOS batch file you must precede the command with the call
keyword. Also, it must not have quotes surrounding the call and the
command."
Your ant "executable" is probably a batch file. For reasons I don't
remember, VS gets confused and likes to exit immediately after running a
batch file as a custom build step.
tyler
More information about the CMake
mailing list