UseJava.cmake: accept jar targets in add_jar
Modify add_jar to also accepts jars by target name.
This commit is contained in:
parent
53a05b8f51
commit
adeafad488
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue