summaryrefslogtreecommitdiffstats
path: root/Modules/UseJava.cmake
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2013-03-13 21:34:50 (GMT)
committerMatthew Woehlke <matthew.woehlke@kitware.com>2013-03-13 21:34:50 (GMT)
commitadeafad48883ee5d6e7dbff3503d692a30e90912 (patch)
treef21e3299052a8aff45226c817fcde1133f38f141 /Modules/UseJava.cmake
parent53a05b8f519496a6390aff8c14588f81d4b8a179 (diff)
downloadCMake-adeafad48883ee5d6e7dbff3503d692a30e90912.zip
CMake-adeafad48883ee5d6e7dbff3503d692a30e90912.tar.gz
CMake-adeafad48883ee5d6e7dbff3503d692a30e90912.tar.bz2
UseJava.cmake: accept jar targets in add_jar
Modify add_jar to also accepts jars by target name.
Diffstat (limited to 'Modules/UseJava.cmake')
-rw-r--r--Modules/UseJava.cmake9
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index efb3fe9..a12d5c1 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -265,7 +265,14 @@ function(add_jar _TARGET_NAME)
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
- if (_JAVA_EXT MATCHES ".java")
+ if (TARGET ${_JAVA_SOURCE_FILE})
+ get_target_property(_JAVA_JAR_PATH ${_JAVA_SOURCE_FILE} JAR_FILE)
+ set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}")
+ list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH})
+ list(APPEND _JAVA_DEPENDS ${_JAVA_SOURCE_FILE})
+ list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_SOURCE_FILE})
+
+ elseif (_JAVA_EXT MATCHES ".java")
file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_JAVA_TARGET_OUTPUT_DIR} ${_JAVA_FULL})
file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL})
string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN)