From adeafad48883ee5d6e7dbff3503d692a30e90912 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Wed, 13 Mar 2013 17:34:50 -0400 Subject: UseJava.cmake: accept jar targets in add_jar Modify add_jar to also accepts jars by target name. --- Modules/UseJava.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- cgit v0.12