mirror of
https://github.com/reactos/CMake.git
synced 2024-12-01 15:30:40 +00:00
UseJava.cmake: simplify path logic
Move logic to determine relative path to .java file to after the file extension check, so that it only executes when it is actually used.
This commit is contained in:
parent
a95968fec9
commit
45c8e4b181
@ -264,18 +264,18 @@ function(add_jar _TARGET_NAME)
|
||||
get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH)
|
||||
get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE)
|
||||
|
||||
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)
|
||||
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
|
||||
if (${_BIN_LEN} LESS ${_SRC_LEN})
|
||||
set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
|
||||
else ()
|
||||
set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
|
||||
endif ()
|
||||
get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH)
|
||||
|
||||
if (_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)
|
||||
string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN)
|
||||
if (${_BIN_LEN} LESS ${_SRC_LEN})
|
||||
set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH})
|
||||
else ()
|
||||
set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH})
|
||||
endif ()
|
||||
get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH)
|
||||
|
||||
list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE})
|
||||
set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class")
|
||||
set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE})
|
||||
|
Loading…
Reference in New Issue
Block a user