Enable Java test more carefully on Apple

The CTEST_RUN_Java option added by commit c8f39193 (Avoid problem
reading jni.h on Macs, 2010-10-25) was a quick hack to disable the Java
test on Mac machines after an update from Apple created a broken jni.h
symlink.  Remove the option and instead test whether jni.h exists as a
readable file before reading it.  This restores the original Java test
enabling logic but makes it robust to the broken symlink.
This commit is contained in:
Brad King 2011-03-18 13:46:57 -04:00
parent ac9f50e091
commit 46c0a5832d
1 changed files with 23 additions and 33 deletions

View File

@ -1868,22 +1868,13 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
ENDIF()
ENDIF()
if(NOT DEFINED CTEST_RUN_Java)
if(APPLE)
set(CTEST_RUN_Java OFF)
else()
set(CTEST_RUN_Java ON)
endif()
endif()
IF(CTEST_RUN_Java)
find_package(Java QUIET)
IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH)
FIND_FILE(JNI_H jni.h
"${JNIPATH}/../include"
"${JNIPATH}/../java/include")
IF(JNI_H)
IF(JNI_H AND EXISTS "${JNI_H}") # in case jni.h is a broken symlink
FILE(READ "${JNI_H}" JNI_FILE)
IF("${JNI_FILE}" MATCHES "JDK1_2")
ADD_TEST(Java ${CMAKE_CTEST_COMMAND}
@ -1898,9 +1889,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
--test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Java")
ENDIF("${JNI_FILE}" MATCHES "JDK1_2")
ENDIF(JNI_H)
ENDIF()
ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW)
ENDIF(CTEST_RUN_Java)
# add some cross compiler tests, for now only with makefile based generators
IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles" OR CMAKE_TEST_GENERATOR MATCHES "KDevelop")