From b01a50567a7ca190e9f39aa2db5f4b0042e9ca4c Mon Sep 17 00:00:00 2001 From: Oliver Buchtala Date: Sun, 3 Apr 2011 00:43:07 +0200 Subject: Java: Create correct jar archive dependencies. The command generating the jar file depends on java_class_filelist which is generated by another command. Signed-off-by: Andreas Schneider --- Modules/UseJava.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index d86fa23..3723f2e 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -289,9 +289,6 @@ function(add_jar _TARGET_NAME) file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") endif() - # Add the target and make sure we have the latest resource files. - add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS}) - if (_JAVA_COMPILE_FILES) # Compile the java files and create a list of class files add_custom_command( @@ -321,7 +318,7 @@ function(add_jar _TARGET_NAME) # create the jar file if (CMAKE_JNI_TARGET) add_custom_command( - TARGET ${_TARGET_NAME} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} COMMAND ${Java_JAR_EXECUTABLE} -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} ${_JAVA_RESOURCE_FILES} @java_class_filelist @@ -335,12 +332,13 @@ function(add_jar _TARGET_NAME) -D_JAVA_TARGET_OUTPUT_NAME=${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" ) else () add_custom_command( - TARGET ${_TARGET_NAME} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} COMMAND ${Java_JAR_EXECUTABLE} -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} ${_JAVA_RESOURCE_FILES} @java_class_filelist @@ -350,10 +348,14 @@ function(add_jar _TARGET_NAME) -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} -P ${_JAVA_SYMLINK_SCRIPT} WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" ) endif (CMAKE_JNI_TARGET) + # Add the target and make sure we have the latest resource files. + add_custom_target(${_TARGET_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + set(${_TARGET_NAME}_INSTALL_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} PARENT_SCOPE) -- cgit v0.12