CMake … Java … Pain …
I've been working quite fervently to get CMake working for a Java project I've taken on and have found that it has a couple of issues still. The first issue is an undefined CMAKE_Java_LINK_EXECUTABLE variable, which because Java doesn't really do linking (JIT takes care of doing something that I haven't looked into yet) we don't really need, but CMake expects it to be there. By simply making it a mv string and setting up the classpath option (via INCLUDE_DIRECTORIES directives) correctly, we can compile our java project using CMake almost the same way we would expect to make a CXX project.
If anyone knows of the platform agnostic way to move files in CMake I'd love to know.
Unfortunately the following changes are required to some CMake 2.8 system files for this to work:
In /usr/share/cmake/Modules/CMakeJavaInformation.cmake:
IF(NOT ${CMAKE_Java_LINK_EXECUTABLE})
SET(CMAKE_Java_LINK_EXECUTABLE
"mv <OBJECTS> <TARGET>")
ENDIF(NOT ${CMAKE_Java_LINK_EXECUTABLE})
In /usr/share/cmake/Modules/CMakeJavaCompiler.cmake.in:
SET(CMAKE_Java_LINK_EXECUTABLE "@CMAKE_Java_LINK_EXECUTABLE@")