Commit dead049e authored by Marc Chevrier's avatar Marc Chevrier

UseJava: OUTPUT_DIR must exists in all cases.

Fixes: #17316
parent c798dc85
......@@ -516,6 +516,8 @@ function(add_jar _TARGET_NAME)
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(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar")
if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION)
......
......@@ -3261,6 +3261,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-options ${build_options}
--test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList")
add_test(Java.JarSourceListAndOutput ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Java"
"${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput"
${build_generator_args}
--build-project hello
--build-target hello3
--build-two-config
--build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput/hello3"
--build-options ${build_options}
--test-command ${JAVA_RUNTIME} -classpath hello3.jar HelloWorld)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput")
# For next test, java tool must have same architecture as toolchain
math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
......
......@@ -11,3 +11,6 @@ add_jar(hello A.java HelloWorld.java)
# use listing file to specify sources
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/java_fileslist "A.java\nHelloWorld.java\n")
add_jar(hello2 @${CMAKE_CURRENT_BINARY_DIR}/java_fileslist)
# use listing file to specify sources and specify output directory (issue #17316)
add_jar(hello3 @${CMAKE_CURRENT_BINARY_DIR}/java_fileslist OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/hello3")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment