Hi all,

I am building a jar file but I can't get the paths right within it.

I have a directory structure like this
source-root/org/some/package/<files>.java
source-root/org/some/other/<files>.java
and I want the compiled .class files to all go into the same jar file.

If I have a CMakeLists.txt in source-root simply do a
add_library(JarName ${FILES})
(where FILES is a list of all the java files relative to source-root) my jar file is full of paths like this:

org/some/package/org/some/package/<files>.java
org/some/other/org/some/other/<files>.java

ie, because CMake builds everything in a directory relative to source- root in the binary tree and then javac puts the files in their package directories using this as a starting point, the package structure gets duplicated.

It seems as though CMake is being over zealous in its use of the -d flag to javac. Either that or at the "link" step the wrong directory is being passed to jar via the -C flag. I have tried to override the - d and -C flags with a combination of set_source_files_properties and set_target_properties with no joy.

Another way I have tried is to have a CMakeLists.txt in the source- root/org/some/package/ directory. If I do this I can get the paths right for that particular branch of the package scheme but can't get the classes in the org/some/other/ branch into the same jar file.

Has anyone managed to do this with CMake? It seems to be an overwhelmingly simple thing to do so I must be doing it wrong!

Thanks,
Rob

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to