Hi there,
I just tried building a JAR file with CMake. The project structure
looks like this:


java_projects/
    +---- CMakeLists.txt
    +---- Project1/
               +---- MANIFEST.MF
               +---- src/
                        +---- com
                                 +---- ... and so on with java source files
               +---- CMakeLists.txt
               +---- ...

In the top most CMakeLists.txt I search for external jars that are
required by most of
the subprojects. I then set them as:

INCLUDE_DIRECTORIES( ${FOO_JAR_PATH} )

I this the correct way of extending the classpath?

Then in the second CMakeLists.txt:
PROJECT(Project1 Java)

INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/ )
ADD_LIBRARY(Project1
        src/com/foo/bar/MainClass.java
        MANIFEST.MF )

When using NMake Makefiles I then get a Project1.jar containing:

 +--- META-INF
          +---  MANIFEST.MF   // Default manifest file
 +--- src/com/foo/bar/com/foo/bar
          +--- MainClass.class
          +--- ... and all required classes
 +--- build.make
 +--- cmake_clean.cmake
 +--- cmake_clean_target.cmake
 +--- depend.internal
 +--- depend.make
 +--- DependInfo.cmake
 +--- flags.make
 +--- progress.make

Is there a way to get rid of the path element src/ and the duplicate
path elements com/foo/bar?
If not .. could you give me a starting point in the cmake source where
the Java stuff is handled?

regards
Andreas Pokorny
_______________________________________________
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

Reply via email to