2004-09-22 22:42:05 +04:00
|
|
|
PROJECT(hello Java)
|
2004-09-23 01:41:04 +04:00
|
|
|
SET(CMAKE_VERBOSE_MAKEFILE 1)
|
2004-09-22 22:42:05 +04:00
|
|
|
SET(OLD_CUSTOM_COMMAND_WAY )
|
|
|
|
IF(NOT OLD_CUSTOM_COMMAND_WAY)
|
2004-09-25 00:34:59 +04:00
|
|
|
INCLUDE_DIRECTORIES(${hello_SOURCE_DIR}
|
2004-09-24 23:40:40 +04:00
|
|
|
${hello_BINARY_DIR} )
|
2004-09-22 22:42:05 +04:00
|
|
|
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)
|