By default, openjpip client can still built even without java compiler. Print a message to the user as warning.

This commit is contained in:
Mathieu Malaterre 2012-02-13 11:41:31 +00:00
parent 07521a5dc2
commit a9b7c7b0b4
1 changed files with 71 additions and 66 deletions

View File

@ -47,16 +47,18 @@ FOREACH(exe ${EXES})
ENDFOREACH(exe) ENDFOREACH(exe)
# Build the two java clients: # Build the two java clients:
FIND_PACKAGE(Java 1.5 REQUIRED) # javac, jar FIND_PACKAGE(Java 1.5 COMPONENTS Development) # javac, jar
# 1. opj_viewer # Only build the java viewer if dev is found:
# build dep list: if(Java_Development_FOUND)
file(GLOB java1_srcs "opj_viewer/src/*.java") # 1. opj_viewer
# build dep list:
file(GLOB java1_srcs "opj_viewer/src/*.java")
# make sure target javac dir exists: # make sure target javac dir exists:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1) file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
# Build java # Build java
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
COMMAND ${Java_JAVAC_EXECUTABLE} COMMAND ${Java_JAVAC_EXECUTABLE}
${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1 ${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1
@ -66,24 +68,24 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${java1_srcs} DEPENDS ${java1_srcs}
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt ${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt
COMMENT "javac *.java; jar cvf -> opj_viewer.jar" COMMENT "javac *.java; jar cvf -> opj_viewer.jar"
) )
# name the target # name the target
ADD_CUSTOM_TARGET(OPJViewerJar ALL ADD_CUSTOM_TARGET(OPJViewerJar ALL
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
COMMENT "building opj_viewer.jar" COMMENT "building opj_viewer.jar"
) )
# 2. opj_viewer_xerces # 2. opj_viewer_xerces
# search for package org.apache.xerces.parsers # search for package org.apache.xerces.parsers
find_file(APACHE_XERCES_JAR find_file(APACHE_XERCES_JAR
NAMES xerces-j2.jar xercesImpl.jar NAMES xerces-j2.jar xercesImpl.jar
PATHS /usr/share/java/ PATHS /usr/share/java/
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
mark_as_advanced(APACHE_XERCES_JAR) mark_as_advanced(APACHE_XERCES_JAR)
if(EXISTS ${APACHE_XERCES_JAR}) if(EXISTS ${APACHE_XERCES_JAR})
configure_file( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in ${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in
${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt ${CMAKE_CURRENT_BINARY_DIR}/opj_viewer_xerces/dist/manifest.txt
@ -124,4 +126,7 @@ if(EXISTS ${APACHE_XERCES_JAR})
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer_xerces.jar
COMMENT "building opj_viewer_xerces.jar" COMMENT "building opj_viewer_xerces.jar"
) )
endif()
else(Java_Development_FOUND)
message(WARNING "No java compiler found. Wont be able to build java viewer")
endif() endif()