hi,

i am tryting to build java code in my otherwise c++ project. for some reason, i 
just cant get add_custom_command to do what i want it to do. here are the lines 
of code that i am currently trying:

SET(MY_FILES FirstJavaFile SecondJavaFile)
SET(CLASS_FILES "")
SET(JAVA_FILES "")
FOREACH(f ${MY_FILES})
  SET(CLASS_FILES "${CLASS_FILES} 
${PROJECT_BINARY_DIR}/${CLASS_DIR}/${f}.class")
  SET(JAVA_FILES "${JAVA_FILES} ${CMAKE_CURRENT_SOURCE_DIR}/${f}.java")
ENDFOREACH(f JAVA_FILES)
message("Java files:  \"${JAVA_FILES}\"")
message("Class files: \"${CLASS_FILES}\"")

# compile all .java files with javac to .class
ADD_CUSTOM_COMMAND(
    OUTPUT  ${CLASS_FILES}
    DEPENDS ${JAVA_FILES}
    COMMAND ${CMAKE_Java_COMPILER} ARGS -d ${PROJECT_BINARY_DIR}/${CLASS_DIR} 
${CMAKE_CURRENT_SOURCE_DIR}/*.java
)


>From my understanding of what add_custom_command should be doing, this should 
>compile FIrstJavaFile.java and SecondJavaFile.java to class files, if they 
>have been changed. but it does nothing.

i am thankful for any tip.

regards,
keyan
_______________________________________________
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