diff options
author | Bruno Nova <brunomb.nova@gmail.com> | 2014-03-19 19:44:46 +0000 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-20 09:50:47 -0400 |
commit | 2abd8efecbc6be237190f8fa2f10d6e0b53e08b9 (patch) | |
tree | cea10a01925c4e01efc0795610e101931ab0dc2f /Modules/UseJava.cmake | |
parent | 0f79dab48bf17e867fe19a7b7140fa7513f4b72d (diff) | |
download | cmake-2abd8efecbc6be237190f8fa2f10d6e0b53e08b9.tar.gz |
UseJava: Copy resource files before compiling the jar (#13360)
Co-Author: Mary Ellen Foster <mefoster@gmail.com>
Diffstat (limited to 'Modules/UseJava.cmake')
-rw-r--r-- | Modules/UseJava.cmake | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 654b4d0f71..127012fda3 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -426,6 +426,7 @@ function(add_jar _TARGET_NAME) set(_JAVA_DEPENDS) set(_JAVA_COMPILE_DEPENDS) set(_JAVA_RESOURCE_FILES) + set(_JAVA_RESOURCE_FILES_RELATIVE) foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) @@ -462,7 +463,8 @@ function(add_jar _TARGET_NAME) __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} "Copying ${_JAVA_SOURCE_FILE} to the build directory") - list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE}) endif () endforeach() @@ -529,7 +531,7 @@ function(add_jar _TARGET_NAME) OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} - ${_JAVA_RESOURCE_FILES} @java_class_filelist + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} @@ -549,7 +551,7 @@ function(add_jar _TARGET_NAME) OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} - ${_JAVA_RESOURCE_FILES} @java_class_filelist + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} |