diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2017-10-12 10:51:01 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2017-10-12 11:05:17 (GMT) |
commit | 48dcb2f0556a6780e50c94ff2e50d5b7c705ac68 (patch) | |
tree | b55a120da3dd9d84d791c8c1def0e08cca9deffd /Modules/UseJava.cmake | |
parent | add1ba92f716121830d91dc136e9eb0096ec9e53 (diff) | |
download | CMake-48dcb2f0556a6780e50c94ff2e50d5b7c705ac68.zip CMake-48dcb2f0556a6780e50c94ff2e50d5b7c705ac68.tar.gz CMake-48dcb2f0556a6780e50c94ff2e50d5b7c705ac68.tar.bz2 |
UseJava: add_jar OUTPUT_DIR option used only for jar generation.
Build artifacts go to CMAKE_CURRENT_BINARY_DIR subdirectory in all cases.
Fixes: #17341
Diffstat (limited to 'Modules/UseJava.cmake')
-rw-r--r-- | Modules/UseJava.cmake | 8 |
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) |