-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Find{Java,JNI}: Consider JAVA_HOME before ENV{JAVA_HOME}
Add a helper module CMakeFindJavaCommon shared between FindJava and FindJNI to select a JAVA_HOME value. Prefer a CMake variable or cache entry first, then an environment variable.
- Loading branch information
Showing
3 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
#============================================================================= | ||
# Copyright 2013-2014 Kitware, Inc. | ||
# | ||
# Distributed under the OSI-approved BSD License (the "License"); | ||
# see accompanying file Copyright.txt for details. | ||
# | ||
# This software is distributed WITHOUT ANY WARRANTY; without even the | ||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the License for more information. | ||
#============================================================================= | ||
# (To distribute this file outside of CMake, substitute the full | ||
# License text for the above reference.) | ||
|
||
# Do not include this module directly from code outside CMake! | ||
set(_JAVA_HOME "") | ||
if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}") | ||
set(_JAVA_HOME "${JAVA_HOME}") | ||
set(_JAVA_HOME_EXPLICIT 1) | ||
else() | ||
set(_ENV_JAVA_HOME "") | ||
if(DEFINED ENV{JAVA_HOME}) | ||
file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME) | ||
endif() | ||
if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}") | ||
set(_JAVA_HOME "${_ENV_JAVA_HOME}") | ||
set(_JAVA_HOME_EXPLICIT 1) | ||
endif() | ||
unset(_ENV_JAVA_HOME) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters