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)
# 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
# build dep list:
file(GLOB java1_srcs "opj_viewer/src/*.java")
# Only build the java viewer if dev is found:
if(Java_Development_FOUND)
# 1. opj_viewer
# build dep list:
file(GLOB java1_srcs "opj_viewer/src/*.java")
# make sure target javac dir exists:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
# Build java
ADD_CUSTOM_COMMAND(
# make sure target javac dir exists:
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes1)
# Build java
ADD_CUSTOM_COMMAND(
OUTPUT ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
COMMAND ${Java_JAVAC_EXECUTABLE}
${java1_srcs} -d ${CMAKE_CURRENT_BINARY_DIR}/classes1
@ -66,24 +68,24 @@ ADD_CUSTOM_COMMAND(
DEPENDS ${java1_srcs}
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer/dist/manifest.txt
COMMENT "javac *.java; jar cvf -> opj_viewer.jar"
)
)
# name the target
ADD_CUSTOM_TARGET(OPJViewerJar ALL
# name the target
ADD_CUSTOM_TARGET(OPJViewerJar ALL
DEPENDS ${LIBRARY_OUTPUT_PATH}/opj_viewer.jar
COMMENT "building opj_viewer.jar"
)
)
# 2. opj_viewer_xerces
# search for package org.apache.xerces.parsers
find_file(APACHE_XERCES_JAR
# 2. opj_viewer_xerces
# search for package org.apache.xerces.parsers
find_file(APACHE_XERCES_JAR
NAMES xerces-j2.jar xercesImpl.jar
PATHS /usr/share/java/
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(
${CMAKE_CURRENT_SOURCE_DIR}/opj_viewer_xerces/dist/manifest.txt.in
${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
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()