2 # determine the compiler to use for Java programs
3 # NOTE, a generator may set CMAKE_Java_COMPILER before
4 # loading this file to force a compiler.
6 IF(NOT CMAKE_Java_COMPILER)
7 # prefer the environment variable CC
8 IF($ENV{JAVA_COMPILER} MATCHES ".+")
9 GET_FILENAME_COMPONENT(CMAKE_Java_COMPILER_INIT $ENV{JAVA_COMPILER} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
10 IF(CMAKE_Java_FLAGS_ENV_INIT)
11 SET(CMAKE_Java_COMPILER_ARG1 "${CMAKE_Java_FLAGS_ENV_INIT}" CACHE STRING "First argument to Java compiler")
12 ENDIF(CMAKE_Java_FLAGS_ENV_INIT)
13 IF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
14 MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_COMPILER:\n$ENV{JAVA_COMPILER}.")
15 ENDIF(NOT EXISTS ${CMAKE_Java_COMPILER_INIT})
16 ENDIF($ENV{JAVA_COMPILER} MATCHES ".+")
18 IF($ENV{JAVA_RUNTIME} MATCHES ".+")
19 GET_FILENAME_COMPONENT(CMAKE_Java_RUNTIME_INIT $ENV{JAVA_RUNTIME} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
20 IF(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
21 MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_RUNTIME:\n$ENV{JAVA_RUNTIME}.")
22 ENDIF(NOT EXISTS ${CMAKE_Java_RUNTIME_INIT})
23 ENDIF($ENV{JAVA_RUNTIME} MATCHES ".+")
25 IF($ENV{JAVA_ARCHIVE} MATCHES ".+")
26 GET_FILENAME_COMPONENT(CMAKE_Java_ARCHIVE_INIT $ENV{JAVA_ARCHIVE} PROGRAM PROGRAM_ARGS CMAKE_Java_FLAGS_ENV_INIT)
27 IF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
28 MESSAGE(SEND_ERROR "Could not find compiler set in environment variable JAVA_ARCHIVE:\n$ENV{JAVA_ARCHIVE}.")
29 ENDIF(NOT EXISTS ${CMAKE_Java_ARCHIVE_INIT})
30 ENDIF($ENV{JAVA_ARCHIVE} MATCHES ".+")
33 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
34 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
35 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
36 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.7;JavaHome]/bin"
37 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.6;JavaHome]/bin"
38 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
39 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
40 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
46 /usr/java/j2sdk1.4.2_04
47 /usr/lib/j2sdk1.4-sun/bin
48 /usr/lib/j2sdk1.5-sun/bin
50 # if no compiler has been specified yet, then look for one
51 IF(CMAKE_Java_COMPILER_INIT)
52 SET(CMAKE_Java_COMPILER ${CMAKE_Java_COMPILER_INIT} CACHE PATH "Java Compiler")
53 ELSE(CMAKE_Java_COMPILER_INIT)
54 FIND_PROGRAM(CMAKE_Java_COMPILER
56 PATHS ${Java_BIN_PATH}
58 ENDIF(CMAKE_Java_COMPILER_INIT)
60 # if no runtime has been specified yet, then look for one
61 IF(CMAKE_Java_RUNTIME_INIT)
62 SET(CMAKE_Java_RUNTIME ${CMAKE_Java_RUNTIME_INIT} CACHE PATH "Java Compiler")
63 ELSE(CMAKE_Java_RUNTIME_INIT)
64 FIND_PROGRAM(CMAKE_Java_RUNTIME
66 PATHS ${Java_BIN_PATH}
68 ENDIF(CMAKE_Java_RUNTIME_INIT)
70 # if no archive has been specified yet, then look for one
71 IF(CMAKE_Java_ARCHIVE_INIT)
72 SET(CMAKE_Java_ARCHIVE ${CMAKE_Java_ARCHIVE_INIT} CACHE PATH "Java Compiler")
73 ELSE(CMAKE_Java_ARCHIVE_INIT)
74 FIND_PROGRAM(CMAKE_Java_ARCHIVE
76 PATHS ${Java_BIN_PATH}
78 ENDIF(CMAKE_Java_ARCHIVE_INIT)
79 ENDIF(NOT CMAKE_Java_COMPILER)
80 MARK_AS_ADVANCED(CMAKE_Java_COMPILER)
82 # configure variables set in this file for fast reload later on
83 CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in
84 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY)
85 SET(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER")