summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-09-17 13:14:33 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-09-17 13:14:33 (GMT)
commit239cec12e086a27b77a5082192a0d4c1da762e70 (patch)
treec83678f73533f3ead8bc3d688c86551d1d46ec8a /Modules
parent2d3c33b19b77a4226859dbc255f5caafc5ea55a5 (diff)
downloadCMake-239cec12e086a27b77a5082192a0d4c1da762e70.zip
CMake-239cec12e086a27b77a5082192a0d4c1da762e70.tar.gz
CMake-239cec12e086a27b77a5082192a0d4c1da762e70.tar.bz2
BUG: commit bug 1123
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeJavaCompiler.cmake.in43
1 files changed, 26 insertions, 17 deletions
diff --git a/Modules/CMakeJavaCompiler.cmake.in b/Modules/CMakeJavaCompiler.cmake.in
index f0ae7c0..975b5d4 100644
--- a/Modules/CMakeJavaCompiler.cmake.in
+++ b/Modules/CMakeJavaCompiler.cmake.in
@@ -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)