Zitat von Marc Schafer <[email protected]>:

I have a java program that generates a header file for the C++ shared
library that I am trying to build with cmake.  The java generator has an ant
script that runs it but it does not take a destination directory for an
argument.  Therefore I have to run it and then copy the resulting files into
my binary directory.  I created the following custom target to do this:

I suggest to do it diffently: copy the source with copy_if_different into your build tree and create the .h file there. If the source files are mentioned in the .xml file, you can use configure_file() to create the .xml (in build tree) from an .xml.in file (in source tree) and run ant on the result.

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
)

Make that a add_custom_command() to get the dependencies right. The custom command for the .h file should have the .xml as dependency (see above).

HS


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to