summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/UseJava-add_jar-native-headers.rst9
-rw-r--r--Modules/CMakeCXXInformation.cmake4
-rw-r--r--Modules/CMakeFortranInformation.cmake4
-rw-r--r--Modules/CMakeGenericSystem.cmake1
-rw-r--r--Modules/UseJava.cmake74
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CursesDialog/ccmake.cxx1
-rw-r--r--Source/QtDialog/CMakeSetup.cxx1
-rw-r--r--Source/cmSystemTools.cxx17
-rw-r--r--Source/cmSystemTools.h4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx2
-rw-r--r--Source/cmakemain.cxx17
-rw-r--r--Source/ctest.cxx1
-rw-r--r--Tests/CMakeLists.txt54
-rw-r--r--Tests/JavaNativeHeaders/CMakeLists.txt18
-rw-r--r--Tests/JavaNativeHeaders/D.cpp10
-rw-r--r--Tests/JavaNativeHeaders/D.java19
-rw-r--r--Tests/JavaNativeHeaders/E.cpp10
-rw-r--r--Tests/JavaNativeHeaders/E.java19
-rw-r--r--Tests/JavaNativeHeaders/HelloWorld3.java15
21 files changed, 240 insertions, 46 deletions
diff --git a/Help/release/dev/UseJava-add_jar-native-headers.rst b/Help/release/dev/UseJava-add_jar-native-headers.rst
new file mode 100644
index 0000000..0370a672
--- /dev/null
+++ b/Help/release/dev/UseJava-add_jar-native-headers.rst
@@ -0,0 +1,9 @@
+UseJava-add_jar-native-headers
+------------------------------
+
+* | The command add_jar from :module:`UseJava` module learns how to generate native
+ headers files using option -h of javac tool.
+ | This capability requires, at least, version 1.8 of Javac tool.
+ | Command create_javah will no longer be supported due to the
+ `suppression of javah tool <http://openjdk.java.net/jeps/313>`_ in the version 1.10
+ of the JDK, so ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake
index 31ccef7..9ac9560 100644
--- a/Modules/CMakeCXXInformation.cmake
+++ b/Modules/CMakeCXXInformation.cmake
@@ -158,10 +158,6 @@ if(NOT CMAKE_INCLUDE_FLAG_CXX)
set(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C})
endif()
-if(NOT CMAKE_INCLUDE_FLAG_SEP_CXX)
- set(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C})
-endif()
-
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index 8e5c027..5f028e4 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -151,10 +151,6 @@ if(NOT CMAKE_INCLUDE_FLAG_Fortran)
set(CMAKE_INCLUDE_FLAG_Fortran ${CMAKE_INCLUDE_FLAG_C})
endif()
-if(NOT CMAKE_INCLUDE_FLAG_SEP_Fortran)
- set(CMAKE_INCLUDE_FLAG_SEP_Fortran ${CMAKE_INCLUDE_FLAG_SEP_C})
-endif()
-
set(CMAKE_VERBOSE_MAKEFILE FALSE CACHE BOOL "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo.")
set(CMAKE_Fortran_FLAGS_INIT "$ENV{FFLAGS} ${CMAKE_Fortran_FLAGS_INIT}")
diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake
index 3eb86f9..02cb464 100644
--- a/Modules/CMakeGenericSystem.cmake
+++ b/Modules/CMakeGenericSystem.cmake
@@ -9,7 +9,6 @@ set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
set(CMAKE_INCLUDE_FLAG_C "-I") # -I
-set(CMAKE_INCLUDE_FLAG_C_SEP "") # , or empty
set(CMAKE_LIBRARY_PATH_FLAG "-L")
set(CMAKE_LIBRARY_PATH_TERMINATOR "") # for the Digital Mars D compiler the link paths have to be terminated with a "/"
set(CMAKE_LINK_LIBRARY_FLAG "-l")
diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake
index b5fc236..939bd7b 100644
--- a/Modules/UseJava.cmake
+++ b/Modules/UseJava.cmake
@@ -20,6 +20,7 @@
# [VERSION version]
# [OUTPUT_NAME name]
# [OUTPUT_DIR dir]
+# [GENERATE_NATIVE_HEADERS target [DESTINATION dir]]
# )
#
# This command creates a <target_name>.jar. It compiles the given
@@ -35,6 +36,14 @@
# The default OUTPUT_DIR can also be changed by setting the variable
# CMAKE_JAVA_TARGET_OUTPUT_DIR.
#
+# Optionaly, using option GENERATE_NATIVE_HEADERS, native header files can be generated
+# for methods declared as native. These files provide the connective glue that allow your
+# Java and C code to interact. An INTERFACE target will be created for an easy usage
+# of generated files. Sub-option DESTINATION can be used to specify output directory for
+# generated header files.
+#
+# GENERATE_NATIVE_HEADERS option requires, at least, version 1.8 of the JDK.
+#
# Additional instructions:
#
# ::
@@ -168,6 +177,22 @@
#
#
#
+# ::
+#
+# For an optimum usage of option GENERATE_NATIVE_HEADERS, it is recommended to
+# include module JNI before any call to add_jar. The produced target for native
+# headers can then be used to compile C/C++ sources with command
+# target_link_libraries.
+#
+#
+# ::
+#
+# find_package(JNI)
+# add_jar(foo foo.java GENERATE_NATIVE_HEADERS foo-native)
+# add_library(bar bar.cpp)
+# target_link_libraries(bar PRIVATE foo-native)
+#
+#
# Target Properties:
#
# ::
@@ -359,6 +384,10 @@
# Create C header files from java classes. These files provide the connective glue
# that allow your Java and C code to interact.
#
+# This command will no longer be supported starting with version 1.10 of the JDK due
+# to the `suppression of javah tool <http://openjdk.java.net/jeps/313>`_.
+# Command ``add_jar(GENERATE_NATIVE_HEADERS)`` must be used instead.
+#
# There are two main signatures for create_javah. The first signature
# returns generated files through variable specified by GENERATED_FILES option:
#
@@ -448,7 +477,7 @@ function(add_jar _TARGET_NAME)
cmake_parse_arguments(_add_jar
""
"VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST"
- "SOURCES;INCLUDE_JARS"
+ "SOURCES;INCLUDE_JARS;GENERATE_NATIVE_HEADERS"
${ARGN}
)
@@ -494,6 +523,31 @@ function(add_jar _TARGET_NAME)
get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE)
endif ()
+ unset (_GENERATE_NATIVE_HEADERS)
+ if (_add_jar_GENERATE_NATIVE_HEADERS)
+ # Raise an error if JDK version is less than 1.8 because javac -h is not supported
+ # by earlier versions.
+ if ("${Java_VERSION}" VERSION_LESS 1.8)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS is not supported with this version of Java.")
+ endif()
+ cmake_parse_arguments (_add_jar_GENERATE_NATIVE_HEADERS "" "DESTINATION" "" ${_add_jar_GENERATE_NATIVE_HEADERS})
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: missing required argument.")
+ endif()
+ list (LENGTH _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS length)
+ if (length GREATER 1)
+ list (REMOVE_AT _add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS 0)
+ message (FATAL_ERROR "ADD_JAR: GENERATE_NATIVE_HEADERS: ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS}: unexpected argument(s).")
+ endif()
+ if (NOT _add_jar_GENERATE_NATIVE_HEADERS_DESTINATION)
+ set (_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir/native_headers")
+ endif()
+
+ set (_GENERATE_NATIVE_HEADERS_TARGET ${_add_jar_GENERATE_NATIVE_HEADERS_UNPARSED_ARGUMENTS})
+ set (_GENERATE_NATIVE_HEADERS_OUTPUT_DIR "${_add_jar_GENERATE_NATIVE_HEADERS_DESTINATION}")
+ set (_GENERATE_NATIVE_HEADERS -h "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
+
if (LIBRARY_OUTPUT_PATH)
set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
else ()
@@ -625,6 +679,7 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_COMPILE_FLAGS}
-classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}"
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
+ ${_GENERATE_NATIVE_HEADERS}
${_JAVA_SOURCES_FILELISTS}
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME}
DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS}
@@ -735,6 +790,17 @@ function(add_jar _TARGET_NAME)
${CMAKE_JAVA_CLASS_OUTPUT_PATH}
)
+ if (_GENERATE_NATIVE_HEADERS)
+ # create an INTERFACE library encapsulating include directory for generated headers
+ add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE)
+ target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}"
+ ${JNI_INCLUDE_DIRS})
+ # this INTERFACE library depends on jar generation
+ add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
+
+ set_property (DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}")
+ endif()
endfunction()
function(INSTALL_JAR _TARGET_NAME)
@@ -1246,6 +1312,12 @@ function(create_javadoc _target)
endfunction()
function (create_javah)
+ if ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.10)
+ message (FATAL_ERROR "create_javah: not supported with this Java version. Use add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ elseif ("${Java_VERSION}" VERSION_GREATER_EQUAL 1.8)
+ message (DEPRECATION "create_javah: this command will no longer be supported starting with version 1.10 of JDK. Update your project by using command add_jar(GENERATE_NATIVE_HEADERS) instead.")
+ endif()
+
cmake_parse_arguments(_create_javah
""
"TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 2bd81d1..bab642b 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 10)
-set(CMake_VERSION_PATCH 20180123)
+set(CMake_VERSION_PATCH 20180124)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 5016320..2b2152c 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -100,6 +100,8 @@ int main(int argc, char const* const* argv)
argc = args.argc();
argv = args.argv();
+ cmSystemTools::EnableMSVCDebugHook();
+ cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
cmCPackLog log;
@@ -108,8 +110,6 @@ int main(int argc, char const* const* argv)
log.SetOutputPrefix("CPack: ");
log.SetVerbosePrefix("CPack Verbose: ");
- cmSystemTools::EnableMSVCDebugHook();
-
if (cmSystemTools::GetCurrentWorkingDirectory().empty()) {
cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
"Current working directory cannot be established."
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 97d5579..17cf628 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -75,6 +75,7 @@ int main(int argc, char const* const* argv)
argc = encoding_args.argc();
argv = encoding_args.argv();
+ cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
cmDocumentation doc;
doc.addCMakeStandardDocSections();
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index bfd43cf..193f4d3 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -55,6 +55,7 @@ int main(int argc, char** argv)
int argc2 = encoding_args.argc();
char const* const* argv2 = encoding_args.argv();
+ cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv2[0]);
// check docs first so that X is not need to get docs
// do docs, if args were given
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index c321236..06b0b3c 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -51,6 +51,8 @@
// include wincrypt.h after windows.h
#include <wincrypt.h>
+#include <fcntl.h> /* _O_TEXT */
+
#include "cm_uv.h"
#else
#include <sys/time.h>
@@ -980,6 +982,21 @@ std::string cmSystemTools::GetRealPath(const std::string& path,
}
#endif
+void cmSystemTools::InitializeLibUV()
+{
+#if defined(_WIN32)
+ // Perform libuv one-time initialization now, and then un-do its
+ // global _fmode setting so that using libuv does not change the
+ // default file text/binary mode. See libuv issue 840.
+ uv_loop_close(uv_default_loop());
+#ifdef _MSC_VER
+ _set_fmode(_O_TEXT);
+#else
+ _fmode = _O_TEXT;
+#endif
+#endif
+}
+
bool cmSystemTools::RenameFile(const char* oldname, const char* newname)
{
#ifdef _WIN32
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index d29ba56..25df1f1 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -503,6 +503,10 @@ public:
static std::string GetRealPath(const std::string& path,
std::string* errorMessage = 0);
#endif
+
+ /** Perform one-time initialization of libuv. */
+ static void InitializeLibUV();
+
private:
static bool s_ForceUnixPaths;
static bool s_RunCommandHideConsole;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1b09600..a511337 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1992,7 +1992,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
if (si.Kind == cmGeneratorTarget::SourceKindObjectSource) {
// FIXME: refactor generation to avoid tracking XML syntax state.
- this->WriteSource(tool, si.Source, " ");
+ this->WriteSource(tool, si.Source, "");
bool have_nested = this->OutputSourceSpecificFlags(si.Source);
if (!exclude_configs.empty()) {
if (!have_nested) {
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx
index 59b908a..b185a1b 100644
--- a/Source/cmakemain.cxx
+++ b/Source/cmakemain.cxx
@@ -16,10 +16,6 @@
#include "cmDynamicLoader.h"
#endif
-#ifdef _WIN32
-#include <fcntl.h> /* _O_TEXT */
-#include <stdlib.h> /* _set_fmode, _fmode */
-#endif
#include "cm_uv.h"
#include "cmsys/Encoding.hxx"
@@ -170,19 +166,8 @@ int main(int ac, char const* const* av)
ac = args.argc();
av = args.argv();
-#if defined(_WIN32)
- // Perform libuv one-time initialization now, and then un-do its
- // global _fmode setting so that using libuv does not change the
- // default file text/binary mode. See libuv issue 840.
- uv_loop_close(uv_default_loop());
-#ifdef _MSC_VER
- _set_fmode(_O_TEXT);
-#else
- _fmode = _O_TEXT;
-#endif
-#endif
-
cmSystemTools::EnableMSVCDebugHook();
+ cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(av[0]);
if (ac > 1) {
if (strcmp(av[1], "--build") == 0) {
diff --git a/Source/ctest.cxx b/Source/ctest.cxx
index ad5fec0..0a6d1d2 100644
--- a/Source/ctest.cxx
+++ b/Source/ctest.cxx
@@ -137,6 +137,7 @@ int main(int argc, char const* const* argv)
cmSystemTools::DoNotInheritStdPipes();
cmSystemTools::EnableMSVCDebugHook();
+ cmSystemTools::InitializeLibUV();
cmSystemTools::FindCMakeResources(argv[0]);
// Dispatch 'ctest --launch' mode directly.
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index fb7313f..506e995 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -3195,29 +3195,51 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
--test-command ${JAVA_RUNTIME} -classpath hello3.jar HelloWorld)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaJarSourceListAndOutput")
- # For next test, java tool must have same architecture as toolchain
+ # For next tests, 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(_isMultiConfig)
- set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah/$<CONFIGURATION>)
- else()
- set (JAVAH_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaJavah)
+ ## next test is valid only if Java version is less than 1.10
+ if ("${Java_VERSION}" VERSION_LESS 1.10)
+ if(_isMultiConfig)
+ 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()
+ ## next test is valid only if Java is, at least, version 1.8
+ if (NOT "${Java_VERSION}" VERSION_LESS 1.8)
+ if(_isMultiConfig)
+ set (JAVANATIVEHEADERS_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/$<CONFIGURATION>)
+ else()
+ set (JAVANATIVEHEADERS_LIBRARY_PATH ${CMake_BINARY_DIR}/Tests/JavaNativeHeaders)
+ endif()
+ add_test(NAME Java.NativeHeaders COMMAND ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/JavaNativeHeaders"
+ "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders"
+ ${build_generator_args}
+ --build-project helloJavaNativeHeaders
+ --build-two-config
+ --build-run-dir "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders/"
+ --build-options ${build_options}
+ --test-command ${JAVA_RUNTIME} -Djava.library.path=${JAVANATIVEHEADERS_LIBRARY_PATH} -classpath hello4.jar HelloWorld3)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/JavaNativeHeaders")
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()
diff --git a/Tests/JavaNativeHeaders/CMakeLists.txt b/Tests/JavaNativeHeaders/CMakeLists.txt
new file mode 100644
index 0000000..7dc2679
--- /dev/null
+++ b/Tests/JavaNativeHeaders/CMakeLists.txt
@@ -0,0 +1,18 @@
+project(helloJavaNativeHeaders Java CXX)
+
+cmake_minimum_required (VERSION 2.6)
+set(CMAKE_VERBOSE_MAKEFILE 1)
+
+find_package(Java COMPONENTS Development)
+include (UseJava)
+
+# JNI support
+find_package(JNI)
+
+add_jar(B1 D.java GENERATE_NATIVE_HEADERS D1-native)
+add_jar(E1 E.java GENERATE_NATIVE_HEADERS E1-native)
+
+add_jar(hello4 HelloWorld3.java)
+
+add_library(D SHARED D.cpp E.cpp)
+target_link_libraries (D PRIVATE D1-native E1-native)
diff --git a/Tests/JavaNativeHeaders/D.cpp b/Tests/JavaNativeHeaders/D.cpp
new file mode 100644
index 0000000..2a90a08
--- /dev/null
+++ b/Tests/JavaNativeHeaders/D.cpp
@@ -0,0 +1,10 @@
+
+#include <jni.h>
+#include <stdio.h>
+
+#include "D.h"
+
+JNIEXPORT void JNICALL Java_D_printName(JNIEnv*, jobject)
+{
+ printf("D\n");
+}
diff --git a/Tests/JavaNativeHeaders/D.java b/Tests/JavaNativeHeaders/D.java
new file mode 100644
index 0000000..449c0df
--- /dev/null
+++ b/Tests/JavaNativeHeaders/D.java
@@ -0,0 +1,19 @@
+class D
+{
+ public D()
+ {
+ }
+
+ public native void printName();
+
+ static {
+ try {
+
+ System.loadLibrary("D");
+
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load.\n" + e);
+ System.exit(1);
+ }
+ }
+}
diff --git a/Tests/JavaNativeHeaders/E.cpp b/Tests/JavaNativeHeaders/E.cpp
new file mode 100644
index 0000000..fb98946
--- /dev/null
+++ b/Tests/JavaNativeHeaders/E.cpp
@@ -0,0 +1,10 @@
+
+#include <jni.h>
+#include <stdio.h>
+
+#include "E.h"
+
+JNIEXPORT void JNICALL Java_E_printName(JNIEnv*, jobject)
+{
+ printf("E\n");
+}
diff --git a/Tests/JavaNativeHeaders/E.java b/Tests/JavaNativeHeaders/E.java
new file mode 100644
index 0000000..30fd95a
--- /dev/null
+++ b/Tests/JavaNativeHeaders/E.java
@@ -0,0 +1,19 @@
+class E
+{
+ public E()
+ {
+ }
+
+ public native void printName();
+
+ static {
+ try {
+
+ System.loadLibrary("D");
+
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Native code library failed to load.\n" + e);
+ System.exit(1);
+ }
+ }
+}
diff --git a/Tests/JavaNativeHeaders/HelloWorld3.java b/Tests/JavaNativeHeaders/HelloWorld3.java
new file mode 100644
index 0000000..77f1fed
--- /dev/null
+++ b/Tests/JavaNativeHeaders/HelloWorld3.java
@@ -0,0 +1,15 @@
+class HelloWorld3
+{
+ public static void main(String args[])
+ {
+ D d;
+ d = new D();
+ d.printName();
+
+ E e;
+ e = new E();
+ e.printName();
+
+ System.out.println("Hello World!");
+ }
+}