2005-12-14 21:51:08 +03:00
|
|
|
|
2009-09-28 19:46:51 +04:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2002-2009 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.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:46:51 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2002-12-11 18:34:35 +03:00
|
|
|
# determine the compiler to use for Java programs
|
2004-09-22 22:42:05 +04:00
|
|
|
# NOTE, a generator may set CMAKE_Java_COMPILER before
|
2002-12-11 18:34:35 +03:00
|
|
|
# loading this file to force a compiler.
|
|
|
|
|
2004-09-22 22:42:05 +04:00
|
|
|
IF(NOT CMAKE_Java_COMPILER)
|
2002-12-11 18:34:35 +03:00
|
|
|
# prefer the environment variable CC
|
|
|
|
IF($ENV{JAVA_COMPILER} MATCHES ".+")
|
2004-09-22 22:42:05 +04:00
|
|
|
GET_FILENAME_COMPONENT(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
|
2005-07-20 23:44:55 +04:00
|
|
|
IF(CMAKE_Java_FLAGS_ENV_INIT)
|
2006-01-25 19:41:05 +03:00
|
|
|
SET(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler")
|
2005-07-20 23:44:55 +04:00
|
|
|
ENDIF(CMAKE_Java_FLAGS_ENV_INIT)
|
2007-06-19 02:01:15 +04:00
|
|
|
IF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
|
2002-12-11 18:34:35 +03:00
|
|
|
MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_COMPILER:\n$ENV{JAVA_COMPILER}.")
|
2007-06-19 02:01:15 +04:00
|
|
|
ENDIF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
|
2002-12-11 18:34:35 +03:00
|
|
|
ENDIF($ENV{JAVA_COMPILER} MATCHES ".+")
|
|
|
|
|
|
|
|
IF($ENV{JAVA_RUNTIME} MATCHES ".+")
|
2004-09-22 22:42:05 +04:00
|
|
|
GET_FILENAME_COMPONENT(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
|
2007-06-19 02:01:15 +04:00
|
|
|
IF(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
|
2002-12-11 18:34:35 +03:00
|
|
|
MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.")
|
2007-06-19 02:01:15 +04:00
|
|
|
ENDIF(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
|
2002-12-11 18:34:35 +03:00
|
|
|
ENDIF($ENV{JAVA_RUNTIME} MATCHES ".+")
|
|
|
|
|
|
|
|
IF($ENV{JAVA_ARCHIVE} MATCHES ".+")
|
2004-09-22 22:42:05 +04:00
|
|
|
GET_FILENAME_COMPONENT(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
|
2007-06-19 02:01:15 +04:00
|
|
|
IF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
|
2002-12-11 18:34:35 +03:00
|
|
|
MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.")
|
2007-06-19 02:01:15 +04:00
|
|
|
ENDIF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
|
2002-12-11 18:34:35 +03:00
|
|
|
ENDIF($ENV{JAVA_ARCHIVE} MATCHES ".+")
|
|
|
|
|
2004-09-22 22:42:05 +04:00
|
|
|
SET(Java_BIN_PATH
|
|
|
|
"[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"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
|
2003-10-16 19:05:04 +04:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
|
2009-10-30 18:55:57 +03:00
|
|
|
$ENV{JAVA_HOME}/bin
|
2002-12-11 18:34:35 +03:00
|
|
|
/usr/bin
|
|
|
|
/usr/lib/java/bin
|
|
|
|
/usr/share/java/bin
|
|
|
|
/usr/local/bin
|
|
|
|
/usr/local/java/bin
|
2009-10-30 18:55:57 +03:00
|
|
|
/usr/local/java/share/bin
|
2004-09-22 22:42:05 +04:00
|
|
|
/usr/java/j2sdk1.4.2_04
|
2005-09-08 18:03:51 +04:00
|
|
|
/usr/lib/j2sdk1.4-sun/bin
|
2009-10-30 18:55:57 +03:00
|
|
|
/usr/java/j2sdk1.4.2_09/bin
|
2005-09-08 18:03:51 +04:00
|
|
|
/usr/lib/j2sdk1.5-sun/bin
|
2009-10-30 18:55:57 +03:00
|
|
|
/opt/sun-jdk-1.5.0.04/bin
|
2002-12-11 18:34:35 +03:00
|
|
|
)
|
|
|
|
# if no compiler has been specified yet, then look for one
|
2004-09-22 22:42:05 +04:00
|
|
|
IF(CMAKE_Java_COMPILER_INIT)
|
|
|
|
SET(CMAKE_Java_COMPILER ${CMAKE_Java_COMPILER_INIT} CACHE PATH "Java Compiler")
|
|
|
|
ELSE(CMAKE_Java_COMPILER_INIT)
|
|
|
|
FIND_PROGRAM(CMAKE_Java_COMPILER
|
2002-12-11 18:34:35 +03:00
|
|
|
NAMES javac
|
2004-09-22 22:42:05 +04:00
|
|
|
PATHS ${Java_BIN_PATH}
|
2002-12-11 18:34:35 +03:00
|
|
|
)
|
2004-09-22 22:42:05 +04:00
|
|
|
ENDIF(CMAKE_Java_COMPILER_INIT)
|
2002-12-11 18:34:35 +03:00
|
|
|
|
|
|
|
# if no runtime has been specified yet, then look for one
|
2004-09-22 22:42:05 +04:00
|
|
|
IF(CMAKE_Java_RUNTIME_INIT)
|
|
|
|
SET(CMAKE_Java_RUNTIME ${CMAKE_Java_RUNTIME_INIT} CACHE PATH "Java Compiler")
|
|
|
|
ELSE(CMAKE_Java_RUNTIME_INIT)
|
|
|
|
FIND_PROGRAM(CMAKE_Java_RUNTIME
|
2002-12-11 18:34:35 +03:00
|
|
|
NAMES java
|
2004-09-22 22:42:05 +04:00
|
|
|
PATHS ${Java_BIN_PATH}
|
2002-12-11 18:34:35 +03:00
|
|
|
)
|
2004-09-22 22:42:05 +04:00
|
|
|
ENDIF(CMAKE_Java_RUNTIME_INIT)
|
2002-12-11 18:34:35 +03:00
|
|
|
|
|
|
|
# if no archive has been specified yet, then look for one
|
2004-09-22 22:42:05 +04:00
|
|
|
IF(CMAKE_Java_ARCHIVE_INIT)
|
|
|
|
SET(CMAKE_Java_ARCHIVE ${CMAKE_Java_ARCHIVE_INIT} CACHE PATH "Java Compiler")
|
|
|
|
ELSE(CMAKE_Java_ARCHIVE_INIT)
|
|
|
|
FIND_PROGRAM(CMAKE_Java_ARCHIVE
|
2002-12-11 18:34:35 +03:00
|
|
|
NAMES jar
|
2004-09-22 22:42:05 +04:00
|
|
|
PATHS ${Java_BIN_PATH}
|
2002-12-11 18:34:35 +03:00
|
|
|
)
|
2004-09-22 22:42:05 +04:00
|
|
|
ENDIF(CMAKE_Java_ARCHIVE_INIT)
|
|
|
|
ENDIF(NOT CMAKE_Java_COMPILER)
|
|
|
|
MARK_AS_ADVANCED(CMAKE_Java_COMPILER)
|
2002-12-11 18:34:35 +03:00
|
|
|
|
|
|
|
# configure variables set in this file for fast reload later on
|
|
|
|
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in
|
2006-06-14 20:28:32 +04:00
|
|
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY)
|
2004-09-22 22:42:05 +04:00
|
|
|
SET(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")
|