summaryrefslogtreecommitdiffstats
path: root/Modules/FindJava.cmake
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2010-08-07 20:29:08 (GMT)
committerAlex Neundorf <neundorf@kde.org>2010-08-07 20:29:08 (GMT)
commit19b68b9faec1868fe6856aebda128a7b2fb3d887 (patch)
tree1256fb86dd356de7121ab8f9afc8ba797be8f5a6 /Modules/FindJava.cmake
parent6bb0b6e91502956fb82362e9805205f2be687de3 (diff)
downloadCMake-19b68b9faec1868fe6856aebda128a7b2fb3d887.zip
CMake-19b68b9faec1868fe6856aebda128a7b2fb3d887.tar.gz
CMake-19b68b9faec1868fe6856aebda128a7b2fb3d887.tar.bz2
Improved version checking for FindJava using the new FPHSA() mode
Alex
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 4cd4389..94522d2 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()