On Sat, Oct 16, 2010 at 01:35:27PM +0200, Andreas Schneider wrote: > http://git.cynapses.org/users/asn/pki.git/tree/cmake/Modules/UseJava.cmake?h=cmake > http://git.cynapses.org/users/asn/pki.git/tree/cmake/Modules/JavaClassFilelist.cmake?h=cmake
Hi, These work great, however I did find a few issues with them for a project I'm working on moving to CMake. I fixed these issues here and the new UseJava.cmake is attached: - Resources changing doesn't trigger a rebuild Solution: add_custom_command to copy each resource file. - Allow .jar files to be specified in the sources list Solution: Search the source paths for a .jar extension and add them to the include path if found. - Allow target names to be given in the sources list Solution: When there is no extension (this introduces some corner cases; not sure if they're acceptable), link to the .jar output for that target. - Allow dependencies on generated .java files Solution: Use add_custom_command(OUTPUT ...) to allow for dependencies for that output file to be listed. This requires a list of output .class files to be made and listed as what the javac command generates and then as a dependency for the jar command. - The local UseJava{ClassFilelist,Symlinks} should probably be baked into UseJava.cmake; I haven't done this work yet. The related commands are just commented out. Symlinks seems to be all that's needed. - Allow output jar files to be dependencies of other commands () - Some variable usage was wrong (CMAKE_JAVA_LIBRARY_OUTPUT_PATH was set above, but then not used below) - Add function to search for .jar files. I'm not sure if the list of default paths is good enough. - Some style changes (no dangling parentheses). There's one hack in determining the relative path (search for _BIN_LEN) to create the final classpath for each file. It works here, but I'm not really a Java guy and other use cases may have been broken by this. --Ben _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake