summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Buchtala <oliver.buchtala@googlemail.com>2011-04-02 22:43:07 (GMT)
committerAndreas Schneider <asn@cryptomilk.org>2011-04-04 09:50:04 (GMT)
commitb01a50567a7ca190e9f39aa2db5f4b0042e9ca4c (patch)
tree2f57df8b912afc27b8798a49c59a6fa20e87f6e7
parentf99c3120c91b9b659d4fce20d5578b6c6674dc3f (diff)
downloadCMake-b01a50567a7ca190e9f39aa2db5f4b0042e9ca4c.zip
CMake-b01a50567a7ca190e9f39aa2db5f4b0042e9ca4c.tar.gz
CMake-b01a50567a7ca190e9f39aa2db5f4b0042e9ca4c.tar.bz2
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 <asn@cryptomilk.org>
-rw-r--r--Modules/UseJava.cmake12
1 files 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)