summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2013-03-13 21:30:16 (GMT)
committerMatthew Woehlke <matthew.woehlke@kitware.com>2013-03-13 21:30:16 (GMT)
commit53a05b8f519496a6390aff8c14588f81d4b8a179 (patch)
treeb15544e528f682fefb80a79b5aef4bc9bec2470e /Modules
parent45c8e4b181b0f638576f2cedcaf911fbab7cab82 (diff)
downloadCMake-53a05b8f519496a6390aff8c14588f81d4b8a179.zip
CMake-53a05b8f519496a6390aff8c14588f81d4b8a179.tar.gz
CMake-53a05b8f519496a6390aff8c14588f81d4b8a179.tar.bz2
UseJava.cmake: fix passing jars to add_jar
Fix setting classpath when encountering a jar argument to add_jar to actually set the variable that is used to specify the classpath to javac, instead of just uselessly appending the jar to CMAKE_JAVA_INCLUDE_PATH (which is never used again at the point where it is modified). Also, list jars so specified as dependencies of compiling the java sources for the jar target.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/UseJava.cmake6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index 7573576..efb3fe9 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -257,6 +257,7 @@ function(add_jar _TARGET_NAME)
set(_JAVA_CLASS_FILES)
set(_JAVA_COMPILE_FILES)
set(_JAVA_DEPENDS)
+ set(_JAVA_COMPILE_DEPENDS)
set(_JAVA_RESOURCE_FILES)
foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES})
get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT)
@@ -284,7 +285,10 @@ function(add_jar _TARGET_NAME)
OR _JAVA_EXT MATCHES ".war"
OR _JAVA_EXT MATCHES ".ear"
OR _JAVA_EXT MATCHES ".sar")
+ set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_SOURCE_FILE}")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_DEPENDS ${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_SOURCE_FILE})
elseif (_JAVA_EXT STREQUAL "")
list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH})
@@ -314,7 +318,7 @@ function(add_jar _TARGET_NAME)
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
${_JAVA_COMPILE_FILES}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
- DEPENDS ${_JAVA_COMPILE_FILES}
+ DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_DEPENDS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
)