[CMake] Order of compilation of Java files

Kedzierski, Artur CIV NSWC Corona, PA13 artur.kedzierski at navy.mil
Mon Mar 12 11:42:44 EDT 2012


Andreas,

Do you mind sharing a CMakeLists.txt for one of your Java projects? 
Thank You.

--
Artur Kedzierski


-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Andreas Pakulat
Sent: Thursday, March 08, 2012 8:33
To: cmake at cmake.org
Subject: Re: [CMake] Order of compilation of Java files

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5684 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120312/f4451220/attachment.bin>


More information about the CMake mailing list