summaryrefslogtreecommitdiffstats
path: root/Modules/FindJava.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-29 18:28:43 (GMT)
committerBrad King <brad.king@kitware.com>2014-01-29 19:02:29 (GMT)
commit4b3614b25a10bf558b3687cee5bac012779866e3 (patch)
tree45551df7b6a925012ef7b78181a837d5bca3734b /Modules/FindJava.cmake
parentbbc82d85e5e721cc705f1d836630c672cd4acf28 (diff)
downloadCMake-4b3614b25a10bf558b3687cee5bac012779866e3.zip
CMake-4b3614b25a10bf558b3687cee5bac012779866e3.tar.gz
CMake-4b3614b25a10bf558b3687cee5bac012779866e3.tar.bz2
Find{Java,JNI}: Use ENV{JAVA_HOME} first when set
Use list(APPEND) instead of set() to append to lists. When ENV{JAVA_HOME} is set explicitly place values based on it at the front their lists.
Diffstat (limited to 'Modules/FindJava.cmake')
-rw-r--r--Modules/FindJava.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index e35fc1d..36624a4 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -67,8 +67,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME)
+
# The HINTS option should only be used for values computed from the system.
-set(_JAVA_HINTS
+set(_JAVA_HINTS)
+if(_JAVA_HOME)
+ list(APPEND _JAVA_HINTS ${_JAVA_HOME}/bin)
+endif()
+list(APPEND _JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
@@ -77,7 +83,6 @@ set(_JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
- $ENV{JAVA_HOME}/bin
)
# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.