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,8 +30,15 @@ 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)
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}
@ -39,22 +46,24 @@ MACRO(ADD_JAVA_LIBRARY LIBRARYNAME SOURCES)
${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE}
-d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/
TARGET ${LIBRARYNAME}_target
OUTPUTS ${CLASS_FILE}.class
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
-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