[CMake] mixed java/c project.
George Neill
georgen at neillnet.com
Sat Oct 18 13:48:49 EDT 2008
Hi All,
On Sat, Oct 18, 2008 at 2:01 AM, George Neill <georgen at neillnet.com> wrote:
> 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?
Well, it looks like this isn't a new issue. (
http://www.mail-archive.com/cmake@cmake.org/msg02564.html )
I was able to get by it by doing this,
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
SET(CMAKE_USER_MAKE_RULES_OVERRIDE "override")
my override.cmake contains,
# 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
<CMAKE_CURRENT_BINARY_DIR>/<OBJECT_DIR>")
ENDIF(NOT CMAKE_Java_COMPILE_OBJECT)
Is this acceptable, or should I be doing something else?
Thanks,
George.
More information about the CMake
mailing list