summaryrefslogtreecommitdiffstats
path: root/Modules/FindJava.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-08-10 18:51:45 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2010-08-10 18:51:45 (GMT)
commit74805b28c1f55a16310efe43465eb76c4e75f46a (patch)
tree327505f9f2820ca55d099625f387c52d29ac0f71 /Modules/FindJava.cmake
parent9cf9d2794c496213f84a78282d56c63763f732d6 (diff)
parent430336c5e1ae90903e3db228594b1c365c26f4a3 (diff)
downloadCMake-74805b28c1f55a16310efe43465eb76c4e75f46a.zip
CMake-74805b28c1f55a16310efe43465eb76c4e75f46a.tar.gz
CMake-74805b28c1f55a16310efe43465eb76c4e75f46a.tar.bz2
Merge topic 'ImprovedVersionCheckingInSomeModules'
430336c Merge branch 'findsubversion_fphsa_cleanup' b6c6156 Use FPHSA() in FindSWIG, including version checking. 656cd2f Improved version checking for FindCUDA using the new mode of FPHSA 126db7b Improved version checking for FindSubversion using the new mode of FPHSA() 77d909b Fix DETAILS string with version number in FHPSA() 19b68b9 Improved version checking for FindJava using the new FPHSA() mode 6bb0b6e Improved version checking for FindRuby using the new mode of FPHSA() 946493f FindSquish doesn't detect the version, remove that from the documentation cb9d1ea Add version checking support to FindFlex and FindPerlLibs
Diffstat (limited to 'Modules/FindJava.cmake')
-rw-r--r--Modules/FindJava.cmake44
1 files changed, 15 insertions, 29 deletions
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index eeb4778..1599433 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -13,6 +13,9 @@
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
#
+# The minimum required version of Java can be specified using the
+# standard CMake syntax, e.g. FIND_PACKAGE(Java 1.5)
+#
# NOTE: ${Java_VERSION} and ${Java_VERSION_STRING} are not guaranteed to be
# identical. For example some java version may return:
# Java_VERSION_STRING = 1.5.0_17
@@ -83,7 +86,6 @@ FIND_PROGRAM(Java_JAVA_EXECUTABLE
)
IF(Java_JAVA_EXECUTABLE)
- set(_java_version_acceptable TRUE)
EXECUTE_PROCESS(COMMAND ${Java_JAVA_EXECUTABLE} -version
RESULT_VARIABLE res
OUTPUT_VARIABLE var
@@ -114,7 +116,6 @@ IF(Java_JAVA_EXECUTABLE)
ELSE()
IF(NOT Java_FIND_QUIETLY)
message(WARNING "regex not supported: ${var}. Please report")
- set(_java_version_acceptable FALSE)
ENDIF(NOT Java_FIND_QUIETLY)
ENDIF()
STRING( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" )
@@ -134,17 +135,6 @@ IF(Java_JAVA_EXECUTABLE)
ENDIF(NOT Java_FIND_QUIETLY)
ENDIF()
- # check version if requested:
- if( Java_FIND_VERSION )
- if("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}")
- set(_java_version_acceptable FALSE)
- endif("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}")
- if( Java_FIND_VERSION_EXACT )
- if("${Java_VERSION}" VERSION_GREATER "${Java_FIND_VERSION}")
- set(_java_version_acceptable FALSE)
- endif("${Java_VERSION}" VERSION_GREATER "${Java_FIND_VERSION}")
- endif( Java_FIND_VERSION_EXACT )
- endif( Java_FIND_VERSION )
ENDIF(Java_JAVA_EXECUTABLE)
@@ -165,17 +155,15 @@ if(Java_FIND_COMPONENTS)
foreach(component ${Java_FIND_COMPONENTS})
# User just want to execute some Java byte-compiled
if(component STREQUAL "Runtime")
- find_package_handle_standard_args(Java DEFAULT_MSG
- Java_JAVA_EXECUTABLE
- _java_version_acceptable
- )
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS Java_JAVA_EXECUTABLE
+ VERSION_VAR Java_VERSION
+ )
elseif(component STREQUAL "Development")
- find_package_handle_standard_args(Java DEFAULT_MSG
- Java_JAVA_EXECUTABLE
- Java_JAR_EXECUTABLE
- Java_JAVAC_EXECUTABLE
- _java_version_acceptable
- )
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
+ VERSION_VAR Java_VERSION
+ )
else()
message(FATAL_ERROR "Comp: ${component} is not handled")
endif()
@@ -183,12 +171,10 @@ if(Java_FIND_COMPONENTS)
endforeach(component)
else()
# Check for everything
- find_package_handle_standard_args(Java DEFAULT_MSG
- Java_JAVA_EXECUTABLE
- Java_JAR_EXECUTABLE
- Java_JAVAC_EXECUTABLE
- _java_version_acceptable
- )
+ find_package_handle_standard_args(Java
+ REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
+ VERSION_VAR Java_VERSION
+ )
endif()