summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-16 13:48:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-10-16 13:48:53 (GMT)
commit800c0e810520bd6fe2827c9c89b0b863df1592b9 (patch)
treeddb91f0b8e7a58b92fa63cdd0fd621d8d4388f26 /Modules
parent9de7ae6e5ec46f87b318591c0e1a32f98df26c63 (diff)
parent48dcb2f0556a6780e50c94ff2e50d5b7c705ac68 (diff)
downloadCMake-800c0e810520bd6fe2827c9c89b0b863df1592b9.zip
CMake-800c0e810520bd6fe2827c9c89b0b863df1592b9.tar.gz
CMake-800c0e810520bd6fe2827c9c89b0b863df1592b9.tar.bz2
Merge topic 'UseJava-add_jar-split-build-and-output-dirs'
48dcb2f0 UseJava: add_jar OUTPUT_DIR option used only for jar generation. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1380
Diffstat (limited to 'Modules')
-rw-r--r--Modules/UseJava.cmake8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index b925ee2..5e06adc 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -481,6 +481,8 @@ function(add_jar _TARGET_NAME)
else()
get_filename_component(_add_jar_OUTPUT_DIR ${_add_jar_OUTPUT_DIR} ABSOLUTE)
endif()
+ # ensure output directory exists
+ file (MAKE_DIRECTORY "${_add_jar_OUTPUT_DIR}")
if (_add_jar_ENTRY_POINT)
set(_ENTRY_POINT_OPTION e)
@@ -515,9 +517,7 @@ function(add_jar _TARGET_NAME)
string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}")
endforeach()
- set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
- # ensure output directory exists
- file (MAKE_DIRECTORY "${CMAKE_JAVA_CLASS_OUTPUT_PATH}")
+ set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir")
set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION)
@@ -548,7 +548,7 @@ function(add_jar _TARGET_NAME)
list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL})
elseif (_JAVA_EXT MATCHES ".java")
- file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL})
+ file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_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)