summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-09-22 18:42:05 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-09-22 18:42:05 (GMT)
commit692ba48c4e5762b370f2999e902b8bd677c77161 (patch)
tree0c9465d0e38a15bd0cb043f234b4e4ab0cee51a2 /Tests
parent597185754420db18d83b2c9e3b9f1e33675bd935 (diff)
downloadCMake-692ba48c4e5762b370f2999e902b8bd677c77161.zip
CMake-692ba48c4e5762b370f2999e902b8bd677c77161.tar.gz
CMake-692ba48c4e5762b370f2999e902b8bd677c77161.tar.bz2
ENH: major changes to support addition of languages from cmake modules directory.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Fortran/CMakeLists.txt2
-rw-r--r--Tests/Java/A.java11
-rw-r--r--Tests/Java/CMakeLists.txt29
-rw-r--r--Tests/Java/HelloWorld.java11
4 files changed, 52 insertions, 1 deletions
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index 2a6c0d4..a7b5042 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -7,6 +7,6 @@ MESSAGE("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
MESSAGE("All cmake variables:")
GET_CMAKE_PROPERTY(res VARIABLES)
FOREACH(var ${res})
- MESSAGE("${var}=\"${${var}}\"")
+ MESSAGE("${var}=\"${${var}}\"\n")
ENDFOREACH(var ${res})
ADD_EXECUTABLE(testf hello.f)
diff --git a/Tests/Java/A.java b/Tests/Java/A.java
new file mode 100644
index 0000000..e34b704
--- /dev/null
+++ b/Tests/Java/A.java
@@ -0,0 +1,11 @@
+class A
+{
+ public A()
+ {
+ }
+
+ public void printName()
+ {
+ System.out.println("A");
+ }
+}
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)
diff --git a/Tests/Java/HelloWorld.java b/Tests/Java/HelloWorld.java
new file mode 100644
index 0000000..54246ec
--- /dev/null
+++ b/Tests/Java/HelloWorld.java
@@ -0,0 +1,11 @@
+class HelloWorld
+{
+ public static void main(String args[])
+ {
+ A a;
+ a = new A();
+ a.printName();
+ System.out.println("Hello World!");
+ }
+}
+