summaryrefslogtreecommitdiffstats
path: root/Tests/Java/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Java/CMakeLists.txt')
-rw-r--r--Tests/Java/CMakeLists.txt24
1 files changed, 15 insertions, 9 deletions
diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt
index 8acfbb8..2bff10d 100644
--- a/Tests/Java/CMakeLists.txt
+++ b/Tests/Java/CMakeLists.txt
@@ -1,6 +1,11 @@
PROJECT(hello Java)
SET(CMAKE_VERBOSE_MAKEFILE 1)
+
SET(OLD_CUSTOM_COMMAND_WAY )
+message("${hello_SOURCE_DIR} STREQUAL ${hello_BINARY_DIR}")
+IF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}")
+ SET(OLD_CUSTOM_COMMAND_WAY 1)
+ENDIF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}")
IF(NOT OLD_CUSTOM_COMMAND_WAY)
INCLUDE_DIRECTORIES(${hello_SOURCE_DIR}
${hello_BINARY_DIR} )
@@ -12,19 +17,20 @@ IF(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 -d ${hello_BINARY_DIR} ${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
- COMMAND ${CMAKE_Java_COMPILER} ARGS -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/HelloWorld.java)
-
- ADD_CUSTOM_TARGET(foo.jar ALL
- DEPENDS ${hello_BINARY_DIR}/A.class ${hello_BINARY_DIR}/HelloWorld.class)
-
- ADD_CUSTOM_COMMAND( TARGET foo.jar
- PRE_BUILD
+ 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 foo.jar *.class)
+ -cvf hello.jar *.class)
+
+ ADD_CUSTOM_TARGET(hello.jar ALL
+ DEPENDS ${hello_BINARY_DIR}/hello.jar)
ENDIF(OLD_CUSTOM_COMMAND_WAY)