diff options
Diffstat (limited to 'Tests/Java/CMakeLists.txt')
-rw-r--r-- | Tests/Java/CMakeLists.txt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt new file mode 100644 index 0000000..cb8f334 --- /dev/null +++ b/Tests/Java/CMakeLists.txt @@ -0,0 +1,29 @@ +PROJECT(hello Java) +SET(OLD_CUSTOM_COMMAND_WAY ) +IF(NOT OLD_CUSTOM_COMMAND_WAY) + INCLUDE_DIRECTORIES(${hello_SOURCE_DIR}) + INCLUDE_DIRECTORIES(${hello_BINARY_DIR}) + ADD_LIBRARY(hello A.java HelloWorld.java) +ENDIF(NOT OLD_CUSTOM_COMMAND_WAY) + + +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) + 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 + COMMAND ${CMAKE_COMMAND} + ARGS -E chdir ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_Java_ARCHIVE} + -cvf foo.jar *.class) +ENDIF(OLD_CUSTOM_COMMAND_WAY) |