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