summaryrefslogtreecommitdiff
path: root/Tests/Java
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-03-18 12:16:18 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-03-29 11:54:42 +0200
commitc177c8e6b829f1dca4bbb81debd362d143868cf2 (patch)
treeb660ed4488cbc8ad323b71fdbc30e157fac00bff /Tests/Java
parent5c2106c71eb2a8b4e547b889fdc8aea3aeaad675 (diff)
downloadcmake-c177c8e6b829f1dca4bbb81debd362d143868cf2.tar.gz
Tests: Java tests should test UseJava.cmake
Diffstat (limited to 'Tests/Java')
-rw-r--r--Tests/Java/CMakeLists.txt45
1 files changed, 6 insertions, 39 deletions
diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt
index b0dfaa5e67..6a69a24643 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)