summaryrefslogtreecommitdiffstats
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-09-27 18:21:05 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-09-27 18:21:05 (GMT)
commit6b9e217beeb2f8f35cd53e98f3e2243958e213f3 (patch)
tree2db196a8b1dd9d32f1b9bfd0351c12e7d11ad8ab /Source/CMakeLists.txt
parenteadf3aea799538e27772a02b0e8bf4b55bfef59c (diff)
downloadCMake-6b9e217beeb2f8f35cd53e98f3e2243958e213f3.zip
CMake-6b9e217beeb2f8f35cd53e98f3e2243958e213f3.tar.gz
CMake-6b9e217beeb2f8f35cd53e98f3e2243958e213f3.tar.bz2
ENH: use jni.h to determine java version
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt38
1 files changed, 23 insertions, 15 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 7ef19f0..f3337b0 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -659,21 +659,29 @@ IF(BUILD_TESTING)
INCLUDE(FindJava)
IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE)
- EXEC_PROGRAM(${JAVA_COMPILE} ARGS -version OUTPUT_VARIABLE OUT)
- IF(OUT MATCHES "invalid flag")
- MESSAGE("Skipping Java Test because ${JAVA_COMPILE} -version produced: ${OUT}")
- ELSE(OUT MATCHES "invalid flag")
- ADD_TEST(Java ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Java"
- "${CMake_BINARY_DIR}/Tests/Java"
- --build-generator ${CMAKE_GENERATOR}
- --build-project hello
- --build-makeprogram ${MAKEPROGRAM}
- --build-two-config
- --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
- --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
- ENDIF(OUT MATCHES "invalid flag")
+ GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
+ FIND_FILE(JNI_H jni.h
+ "${JNIPATH}/../include"
+ "${JNIPATH}/../java/include")
+ IF(JNI_H)
+ FILE(READ ${JNI_H} JNI_FILE)
+ IF("${JNI_FILE}" MATCHES JDK1_2)
+ ADD_TEST(Java ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Java"
+ "${CMake_BINARY_DIR}/Tests/Java"
+ --build-generator ${CMAKE_GENERATOR}
+ --build-project hello
+ --build-makeprogram ${MAKEPROGRAM}
+ --build-two-config
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/"
+ --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
+ ELSE("${JNI_FILE}" MATCHES JDK1_2)
+ MESSAGE("No Java Test because ${JNI_FILE} does not contain JDK1_2 define")
+ ENDIF("${JNI_FILE}" MATCHES JDK1_2)
+ ELSE(JNI_H)
+ MESSAGE("No Java Test because jni.h could not be found. tried:\n${JNIPATH}/../include and ${JNIPATH}/../java/include")
+ ENDIF(JNI_H)
ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE)
ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")