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