[trunk] User can now control source/target java version

Fixes issue 303
This commit is contained in:
Mathieu Malaterre 2014-03-18 15:00:23 +00:00
parent 6d9e8a5a63
commit 51ab074d50
1 changed files with 10 additions and 0 deletions

View File

@ -59,6 +59,14 @@ endforeach()
# Build the two java clients: # Build the two java clients:
find_package(Java 1.5 COMPONENTS Development) # javac, jar find_package(Java 1.5 COMPONENTS Development) # javac, jar
# User can override this:
if(NOT DEFINED JAVA_SOURCE_VERSION)
set(JAVA_SOURCE_VERSION 1.5)
endif()
if(NOT DEFINED JAVA_TARGET_VERSION)
set(JAVA_TARGET_VERSION 1.5)
endif()
# Only build the java viewer if dev is found: # Only build the java viewer if dev is found:
if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE) if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
set(jflags $ENV{JFLAGS}) set(jflags $ENV{JFLAGS})
@ -97,6 +105,7 @@ if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
add_custom_command( add_custom_command(
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags} COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
-classpath ${APACHE_XERCES_JAR} -classpath ${APACHE_XERCES_JAR}
${java2_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes2 ${java2_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes2
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
@ -127,6 +136,7 @@ if(Java_Development_FOUND AND Java_JAVAC_EXECUTABLE)
add_custom_command( add_custom_command(
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags} COMMAND ${Java_JAVAC_EXECUTABLE} ${jflags}
-source ${JAVA_SOURCE_VERSION} -target ${JAVA_TARGET_VERSION}
${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1 ${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1
COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar COMMAND ${Java_JAR_EXECUTABLE} cfm ${LIBRARY_OUTPUT_PATH}/opj_jpip_viewer.jar
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt -C ${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt -C