[CMake] compiling java

Rafael Pereira Rafael.Pereira at quality.com.br
Fri Jan 11 07:08:38 EST 2008


I have found some problem while trying to compile java code using cmake.

The code below exposes the problem:

I have the following directory structure:

myhome
 |
 |_ testeCMake
     |
     |_ teste
     |   |
     |   |_ main.java
     |_ CMakeLists.txt


inside teste directory has a main.java with simple code:


public class Main {

   public static void main(String[] args){

   }

}

and CMakeLists.txt:

PROJECT(teste Java)

ADD_LIBRARY(teste teste/Main.java)



When i run inside myhome/testeCMake/teste:

cmake . ; make 

cmake works smoothly... everything's fine.

But if i wanna run cmake inside testeCMake with a CMakeLists.txt point
to 
a CMakeLists.txt inside teste directory, with this new config:

foo
 |
 |_ testeCMake
     |
     |_ teste
     |   |
     |   |_ main.java
     |   |_ CMakeLists.txt
     |_ CMakeLists.txt


foo/testeCMake/CMakeLists.txt:

ADD_SUBDIRECTORY(teste)

and foo/testeCMake/teste/CMakeLists.txt:


PROJECT(teste Java)

ADD_LIBRARY(teste teste/Main.java)


whem i run cmake . and make, i receive the following error:

[foo at localhost testeCMake]$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/foo/testeCMake

[foo at localhost testeCMake]$ make
Scanning dependencies of target teste
[100%] Building Java object teste/CMakeFiles/teste.dir/Main.class
javac: directory not found: CMakeFiles/teste.dir
Usage: javac <options> <source files>
use -help for a list of possible options
make[2]: *** [teste/CMakeFiles/teste.dir/Main.class] Error 2
make[1]: *** [teste/CMakeFiles/teste.dir/all] Error 2
make: *** [all] Error 2


It seems that cmake doesn't enter inside the teste directory to execute
javac
and jar, and doesn't find the temporaly(CMakeFiles/teste.dir) directory
that
is inside /home/foo/testeCMake/teste 

The CMake docs doesn't speak anything about it, or i didn't.
Anybody already got this error ? Any ideas or sugestions?

Thanks in advance, Rafael.






--------------------------------------------------------------------------------------------------------
O conteúdo desta mensagem e de seus anexos é de uso restrito e confidencial, sendo o seu sigilo protegido por lei. Estas informações não podem ser divulgadas sem prévia autorização escrita. Se você não é o destinatário desta mensagem, ou o responsável pela sua entrega, apague-a imediatamente e avise ao remetente, respondendo a esta mensagem. Alertamos que esta mensagem transitou por rede pública de comunicação, estando, portanto, sujeita aos riscos inerentes a essa forma de comunicação. A QUALITY SOFTWARE não se responsabiliza por conclusões, opiniões, ou outras informações nesta mensagem que não tenham sido emitidas por seus integrantes.


This e-mail and any attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information. In the event of any technical difficulty with this email, please contact the sender. QUALITY SOFTWARE is not responsible for conclusion, opinions or any kind of information in this message that doesn’t come from our personnel.
--------------------------------------------------------------------------------------------------------



More information about the CMake mailing list