[CMake] mixed java/c project.

George Neill georgen at neillnet.com
Sat Oct 18 03:01:14 EDT 2008


Hi all,

  I am trying to convert a project to cmake which has mixed java and c
compilations.  Here's the project layout,

  project/
     -> src/c
     -> src/java

I get the java project to build fine if I use the top level
CMakeLists.txt file, but if I use add_subdirectory(src/java) in the
top level CMakeLists.txt and create a CMakeLists.txt file in src/java
it appears to break (below is the error)

The -d option of the javac command line appears to be coming out wrong
... CMakeFiles/luajava.dir/org/keplerproject/luajava should actually
be src/java/CMakeFiles/luajava.dir/org/keplerproject/luajava

I took a look in Modules/CMakeJavaInformation.cmake and here's what I found,

# compile a Java file into an object file
IF(NOT CMAKE_Java_COMPILE_OBJECT)
  SET(CMAKE_Java_COMPILE_OBJECT
    "<CMAKE_Java_COMPILER>   <FLAGS> <SOURCE> -d <OBJECT_DIR>")
ENDIF(NOT CMAKE_Java_COMPILE_OBJECT)

OBJECT_DIR seems to be the wrong place,  any ideas on the best way to fix this?

TIA,
George.



bash-3.00$ make VERBOSE=1
/usr/bin/cmake -H/home/gneill/tmp/luajava-1.1
-B/home/gneill/tmp/luajava-1.1/build --check-build-system
CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start
/home/gneill/tmp/luajava-1.1/build/CMakeFiles 9
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/gneill/tmp/luajava-1.1/build'
make -f src/java/CMakeFiles/luajava.dir/build.make
src/java/CMakeFiles/luajava.dir/depend
make[2]: Entering directory `/home/gneill/tmp/luajava-1.1/build'
make[2]: Nothing to be done for `src/java/CMakeFiles/luajava.dir/depend'.
make[2]: Leaving directory `/home/gneill/tmp/luajava-1.1/build'
make -f src/java/CMakeFiles/luajava.dir/build.make
src/java/CMakeFiles/luajava.dir/build
make[2]: Entering directory `/home/gneill/tmp/luajava-1.1/build'
/usr/bin/cmake -E cmake_progress_report
/home/gneill/tmp/luajava-1.1/build/CMakeFiles 1
[ 11%] Building Java object
src/java/CMakeFiles/luajava.dir/org/keplerproject/luajava/CPtr.class
/usr/java6_64/bin/javac    -sourcepath
/home/gneill/tmp/luajava-1.1/src/java
/home/gneill/tmp/luajava-1.1/src/java/org/keplerproject/luajava/CPtr.java
-d CMakeFiles/luajava.dir/org/keplerproject/luajava
javac: directory not found: CMakeFiles/luajava.dir/org/keplerproject/luajava
Usage: javac <options> <source files>
use -help for a list of possible options
make[2]: *** [src/java/CMakeFiles/luajava.dir/org/keplerproject/luajava/CPtr.class]
Error 2
make[2]: Leaving directory `/home/gneill/tmp/luajava-1.1/build'
make[1]: *** [src/java/CMakeFiles/luajava.dir/all] Error 2
make[1]: Leaving directory `/home/gneill/tmp/luajava-1.1/build'
make: *** [all] Error 2


More information about the CMake mailing list