On 08.03.12 06:39:37, Kedzierski, Artur CIV NSWC Corona, PA13 wrote:
> I am trying to use CMake for a small Java project that's part of a bigger C++ 
> project.
> I have a Java project that looks like that:
> 
> project(MyProject Java)
> include_directories("${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MyProject.dir")
> add_library(MyProject
>     file1.java
>     file2.java
>     file3.java
> )
> 
> It works on Linux. However, when I tried it on Windows, I've ran into two 
> problems:
> 1) The resulting *.class files were placed in "${CMAKE_CURRENT_BINARY_DIR}". 
> As a 
> work around, I changed include_directories to be:
> include_directories("${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/MyProject.dir" 
> "${CMAKE_CURRENT_BINARY_DIR}")
> Is there a way to specify where the *.class file will be generated?
> 
> 2) Unlike on Linux, the java files are not compiled in a listed order. I have 
> dependencies where
> one file2.java depends on file1.class so it doesn't compile. 
> How can I tell it to compile the *.java files in specific order? Is there a 
> way for CMake to automatically
> determine the dependencies?

I've looked at using CMake to build some Java files (in an otherwise
C++/C project) some time ago and the result was that Java-support simply
does not fit with CMake's language and functions - at least not in the
way include_directories() and co are currently implemented for Java. So
I've simply opted for custom-command's and targets to compile Java.

Andreas

--

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

Reply via email to