CMakeFindJavaCommon.cmake 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #=============================================================================
  2. # Copyright 2013-2014 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # Do not include this module directly from code outside CMake!
  14. set(_JAVA_HOME "")
  15. if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}")
  16. set(_JAVA_HOME "${JAVA_HOME}")
  17. set(_JAVA_HOME_EXPLICIT 1)
  18. else()
  19. set(_ENV_JAVA_HOME "")
  20. if(DEFINED ENV{JAVA_HOME})
  21. file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME)
  22. endif()
  23. if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}")
  24. set(_JAVA_HOME "${_ENV_JAVA_HOME}")
  25. set(_JAVA_HOME_EXPLICIT 1)
  26. endif()
  27. unset(_ENV_JAVA_HOME)
  28. endif()