summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@sap.com>2015-08-05 07:46:02 (GMT)
committerBrad King <brad.king@kitware.com>2015-08-21 13:30:08 (GMT)
commit4476feac33a88942ebbe2d988c7db4a575de716f (patch)
tree71b32923e9c02897260ed17b988786207d2b0cda /Tests/CMakeLists.txt
parentf9865743ed942b1932d664d136a4ad505b724bf6 (diff)
downloadCMake-4476feac33a88942ebbe2d988c7db4a575de716f.zip
CMake-4476feac33a88942ebbe2d988c7db4a575de716f.tar.gz
CMake-4476feac33a88942ebbe2d988c7db4a575de716f.tar.bz2
UseJava: Add support for javah tool
Add a `create_javah` API.
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 35b29bf..801d7e8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3036,6 +3036,31 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--build-options ${build_options}
--test-command ${JAVA_RUNTIME} -classpath hello2.jar HelloWorld)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceList")
+
+ # For next test, java tool must have same architecture as toolchain
+ math(EXPR _object_mode "${CMAKE_SIZEOF_VOID_P} * 8")
+ execute_process(
+ COMMAND "${Java_JAVA_EXECUTABLE}" -d${_object_mode} -version
+ OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _result
+ )
+ if(_result EQUAL 0)
+ if(CMAKE_CONFIGURATION_TYPES)
+ set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>)
+ else()
+ set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah)
+ endif()
+ add_test(NAME Java.Javah COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/JavaJavah"
+ "${CMake_BINARY_DIR}/Tests/JavaJavah"
+ ${build_generator_args}
+ --build-project helloJavah
+ --build-two-config
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaJavah/"
+ --build-options ${build_options}
+ --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVAH_LIBRARY_PATH} -classpath hello3.jar HelloWorld2)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJavah")
+ endif()
endif()
endif()
endif()