summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-07-26 18:54:33 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-07-26 18:54:33 (GMT)
commit2b16232d4535cf438be879d86c013e9945dc9f52 (patch)
treec5240c6da03fd039620c4ee7b7bfa09777b2460c /Tests
parentb3dba1a145974361d8afa56ffa66aaadb4e3cb01 (diff)
parent1417a55754d97810b85deb0f51793b0c4ceee4e8 (diff)
downloadCMake-2b16232d4535cf438be879d86c013e9945dc9f52.zip
CMake-2b16232d4535cf438be879d86c013e9945dc9f52.tar.gz
CMake-2b16232d4535cf438be879d86c013e9945dc9f52.tar.bz2
Merge topic 'asn_java_support'
1417a55 Java: Fix documentation format and indentation 0b7627d Java: Use set_property/get_property for target variables. b01a505 Java: Create correct jar archive dependencies. f99c312 Java: Added some dependency magic to avoid recompilations. f3233ba Java: Create java_class_filelist only if it does't exist. a22ed3d Tests: Check for the new Java exeutable variables. c177c8e Tests: Java tests should test UseJava.cmake 5c2106c Modules: Added CMake Java support. a4b6275 FindJava: Find missing java development executables.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt4
-rw-r--r--Tests/Java/CMakeLists.txt45
2 files changed, 8 insertions, 41 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 2ad9a77..4bf83b7 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1903,8 +1903,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF()
ENDIF()
- find_package(Java QUIET)
- IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW
+ find_package(Java COMPONENTS Development QUIET)
+ IF(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW
AND NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Xcode")
GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
FIND_FILE(JNI_H jni.h
diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt
index b0dfaa5..6a69a24 100644
--- a/Tests/Java/CMakeLists.txt
+++ b/Tests/Java/CMakeLists.txt
@@ -1,42 +1,9 @@
-cmake_minimum_required (VERSION 2.6)
-PROJECT(hello Java)
-SET(CMAKE_VERBOSE_MAKEFILE 1)
-
-IF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}")
- MESSAGE("In Source, building Java using ADD_CUSTOM_COMMAND()")
- SET(OLD_CUSTOM_COMMAND_WAY 1)
-ELSE("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}")
- MESSAGE("Out of source, using built-in Java support")
- SET(OLD_CUSTOM_COMMAND_WAY )
-ENDIF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}")
-
-IF(NOT OLD_CUSTOM_COMMAND_WAY)
-
- INCLUDE_DIRECTORIES(${hello_SOURCE_DIR}
- ${hello_BINARY_DIR} )
- ADD_LIBRARY(hello A.java HelloWorld.java)
+project(hello Java)
-ELSE(NOT OLD_CUSTOM_COMMAND_WAY)
-
- ADD_CUSTOM_COMMAND(
- OUTPUT ${hello_BINARY_DIR}/A.class
- MAIN_DEPENDENCY ${hello_SOURCE_DIR}/A.java
- COMMAND ${CMAKE_Java_COMPILER} ARGS -classpath . -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/A.java)
- ADD_CUSTOM_COMMAND(
- OUTPUT ${hello_BINARY_DIR}/HelloWorld.class
- MAIN_DEPENDENCY ${hello_SOURCE_DIR}/HelloWorld.java
- DEPENDS ${hello_BINARY_DIR}/A.class
- COMMAND ${CMAKE_Java_COMPILER} ARGS -classpath . -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/HelloWorld.java)
- ADD_CUSTOM_COMMAND(
- OUTPUT ${hello_BINARY_DIR}/hello.jar
- DEPENDS ${hello_BINARY_DIR}/A.class ${hello_BINARY_DIR}/HelloWorld.class
- COMMAND ${CMAKE_COMMAND}
- ARGS -E chdir ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_Java_ARCHIVE}
- -cvf hello.jar *.class)
-
- ADD_CUSTOM_TARGET(hello_jar ALL
- DEPENDS ${hello_BINARY_DIR}/hello.jar)
+cmake_minimum_required (VERSION 2.6)
+set(CMAKE_VERBOSE_MAKEFILE 1)
-ENDIF(NOT OLD_CUSTOM_COMMAND_WAY)
+find_package(Java COMPONENTS Development)
+include (UseJava)
+add_jar(hello A.java HelloWorld.java)