diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2017-10-10 07:38:43 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2017-10-10 08:00:23 (GMT) |
commit | dead049e0b4ff531866ef9bf362f3f5e8fb177aa (patch) | |
tree | f9ffe4758e59beb4212234502941ec83f6b8aaaf | |
parent | c798dc8573a205f90663e9983b793b21fea28521 (diff) | |
download | CMake-dead049e0b4ff531866ef9bf362f3f5e8fb177aa.zip CMake-dead049e0b4ff531866ef9bf362f3f5e8fb177aa.tar.gz CMake-dead049e0b4ff531866ef9bf362f3f5e8fb177aa.tar.bz2 |
UseJava: OUTPUT_DIR must exists in all cases.
Fixes: #17316
-rw-r--r-- | Modules/UseJava.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/Java/CMakeLists.txt | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 1182875..b925ee2 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -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) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ce53454..c25fc44 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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") diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt index e1bcf3c..0b8269b 100644 --- a/Tests/Java/CMakeLists.txt +++ b/Tests/Java/CMakeLists.txt @@ -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") |