[CMake] CMake Java Support
Allen D Byrne
byrn at hdfgroup.org
Fri Jan 14 11:19:33 EST 2011
Andreas,
The problem is a CMake issue with how ';' is interpreted. In the USE_JAVA.CMAKE file (lines 227-243):
> if (_JAVA_COMPILE_FILES)
> # Compile the java files and create a list of class files
> add_custom_command(
> TARGET ${_TARGET_NAME}
> COMMAND ${CMAKE_Java_COMPILER}
> ${CMAKE_JAVA_COMPILE_FLAGS}
> -classpath ${CMAKE_JAVA_INCLUDE_PATH_FINAL}
> -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH}
> ${_JAVA_COMPILE_FILES}
> COMMAND ${CMAKE_COMMAND}
> -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH}
> -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}"
> -P ${_JAVA_CLASS_FILELIST_SCRIPT}
> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> COMMENT "Building Java objects for ${_TARGET_NAME}.jar"
> )
> endif (_JAVA_COMPILE_FILES)
Line 233
> -classpath ${CMAKE_JAVA_INCLUDE_PATH_FINAL}
On windows with the VS generator this converts the ';' characters to spaces. I can't remember how to adjust this line so that this classpath value is correct on all platforms? This is were I hope a CMake guru could help.
So in summary, two issues; the classpath on windows and my suggested addition of the ${_TARGET_NAME}_CLASSPATH variable. Everything else is fine with me!
I owe you a lunch for making my task easy,
Allen
>
> On Friday 14 January 2011 16:32:16 you wrote:
> > Andreas,
>
> Hi Allen,
>
> > Thanks, I do have most everything working, setting the version was the
> > key!
> > Concerning the '.' at the beginning of my proposed patch, I added that
> > because the CMAKE_JAVA_INCLUDE_PATH_FINAL started with a seperator and I
> > didn't look into why. I find this 'set' command very useful and I suggest
> > you consider adding it (with or without the leading '.'). Note that I
> > discovered a bug with Windows and the Visual Studio generator. The use of
> > CMAKE_JAVA_INCLUDE_PATH_FINAL in the add_custom_command changes the ';'
> > seperator into spaces - I think it needs to be escaped somehow - maybe the
> > CMake gurus have a suggestion?
>
> I'm not a java programmer and I haven't tested this stuff on Windows. Please
> tell which variables have the wrong ; or : or whatever and what it should look
> like. I already did some things to get it working on Windows but never tested.
>
> The more details you give the easier it is to fix. If you could print out the
> variables I could try to fix it and add what you need.
>
>
> -- andreas
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110114/9ab7c911/attachment-0001.htm>
More information about the CMake
mailing list