From 232089f40025a5215c395ea8d2d7cb790c9d4001 Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Tue, 29 Nov 2016 15:14:32 -0800 Subject: [PATCH] cmake: Check for JAVA in top-level CMakeLists.txt Moved require for Java/JNI/mraajava to top-level CMakeLists.txt which will fail early if these are NOT found (vs failing in the src-level CMakeLists.txt Signed-off-by: Noel Eck --- CMakeLists.txt | 7 +++++++ src/CMakeLists.txt | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4482ac9d..ace639ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,13 @@ if (BUILDSWIGNODE) find_package (Node REQUIRED) endif (BUILDSWIGNODE) +# Find JAVA/JNI +if (BUILDSWIGJAVA) + find_package (Java REQUIRED) + find_package (JNI REQUIRED) + pkg_check_modules (MRAAJAVA REQUIRED mraajava>=0.8.0) +endif (BUILDSWIGJAVA) + # Find swig if any wrapper is enabled if (BUILDSWIGPYTHON OR BUILDSWIGNODE OR BUILDSWIGJAVA) find_package (SWIG 3.0.5 REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 560584ae..42007fe3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -221,9 +221,6 @@ endmacro(upm_swig_node) macro(upm_swig_java) # Skip if the libname is in the blacklist if (NOT ";${JAVASWIG_BLACKLIST};" MATCHES ";${libname};") - FIND_PACKAGE (JNI REQUIRED) - pkg_check_modules (MRAAJAVA REQUIRED mraajava>=0.8.0) - include_directories ( ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}