BUG: commit bug 1123

This commit is contained in:
Bill Hoffman 2004-09-17 09:14:33 -04:00
parent 2d3c33b19b
commit 239cec12e0
1 changed files with 26 additions and 17 deletions

View File

@ -30,31 +30,40 @@ MACRO(ADD_JAVA_LIBRARY LIBRARYNAME SOURCES)
ADD_CUSTOM_TARGET(${LIBRARYNAME}_target ALL)
SET(CMAKE_JAVA_ALL_CLASS_FILES "")
FOREACH(SOURCE ${SOURCES})
GET_FILENAME_COMPONENT(CLASS_FILE ${SOURCE} NAME_WE)
ADD_CUSTOM_COMMAND(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
COMMAND ${CMAKE_JAVA_COMPILER}
ARGS ${CMAKE_JAVA_COMPILE_FLAGS}
-classpath ${CMAKE_JAVA_INCLUDE_PATH_TOTAL}
${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/
TARGET ${LIBRARYNAME}_target
OUTPUTS ${CLASS_FILE}.class
COMMENT "Java File" )
SET(CMAKE_JAVA_ALL_CLASS_FILES ${CMAKE_JAVA_ALL_CLASS_FILES} ${CLASS_FILE}.class)
SET(CMAKE_JAVA_ALL_CLASS_FILE_PATHS "")
SET(SKIP 1)
FOREACH(SOURCE ${ARGV})
IF(SKIP)
SET(SKIP 0)
ELSE(SKIP)
GET_FILENAME_COMPONENT(CLASS_FILE_PATH ${SOURCE} PATH)
GET_FILENAME_COMPONENT(CLASS_FILE_NAME ${SOURCE} NAME_WE)
SET(CLASS_FILE "${CLASS_FILE_PATH}/${CLASS_FILE_NAME}")
ADD_CUSTOM_COMMAND(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
COMMAND ${CMAKE_JAVA_COMPILER}
ARGS ${CMAKE_JAVA_COMPILE_FLAGS}
-classpath ${CMAKE_JAVA_INCLUDE_PATH_TOTAL}
${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/
TARGET ${LIBRARYNAME}_target
OUTPUTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${CLASS_FILE}.class"
COMMENT "Java File" )
SET(CMAKE_JAVA_ALL_CLASS_FILES ${CMAKE_JAVA_ALL_CLASS_FILES} ${CLASS_FILE}.class)
SET(CMAKE_JAVA_ALL_CLASS_FILE_PATHS ${CMAKE_JAVA_ALL_CLASS_FILE_PATHS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${CLASS_FILE}.class)
ENDIF(SKIP)
ENDFOREACH(SOURCE)
IF(LIBRARY_OUTPUT_PATH)
SET(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH})
ELSE(LIBRARY_OUTPUT_PATH)
SET(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(LIBRARY_OUTPUT_PATH)
ADD_CUSTOM_COMMAND(SOURCE ${CMAKE_JAVA_ALL_CLASS_FILES}
ADD_CUSTOM_COMMAND(SOURCE ${CMAKE_JAVA_ALL_CLASS_FILE_PATHS}
COMMAND ${CMAKE_COMMAND}
ARGS -E chdir ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_JAVA_ARCHIVE}
-cvf ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}/${LIBRARYNAME}.jar *.class
${CMAKE_JAVA_ARCHIVE}
-cvf ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}/${LIBRARYNAME}.jar ${CMAKE_JAVA_ALL_CLASS_FILES}
TARGET ${LIBRARYNAME}_target
DEPENDS ${CMAKE_JAVA_ALL_CLASS_FILES}
DEPENDS ${CMAKE_JAVA_ALL_CLASS_FILE_PATHS}
OUTPUTS ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH}/${LIBRARYNAME}.jar
COMMENT "Java Archive")
ADD_CUSTOM_COMMAND(SOURCE ${LIBRARYNAME}_target
@ -63,4 +72,4 @@ MACRO(ADD_JAVA_LIBRARY LIBRARYNAME SOURCES)
ELSE(CMAKE_JAVA_COMPILER AND CMAKE_JAVA_ARCHIVE)
MESSAGE(SEND_ERROR "Java compiler and/or Java archiver not found")
ENDIF(CMAKE_JAVA_COMPILER AND CMAKE_JAVA_ARCHIVE)
ENDMACRO(ADD_JAVA_LIBRARY LIBRARYNAME SOURCES)
ENDMACRO(ADD_JAVA_LIBRARY LIBRARYNAME SOURCES)