[CMake] Order of compilation of Java files

Kedzierski, Artur CIV NSWC Corona, PA13 artur.kedzierski at navy.mil
Thu Mar 8 09:39:37 EST 2012


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?

Thank You

--
Artur Kedzierski


-------------- 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/20120308/17c22b01/attachment-0001.bin>


More information about the CMake mailing list