[CMake] Path problem when building a jar file
Robert Haines
rhaines at manchester.ac.uk
Tue Oct 28 14:43:32 EDT 2008
Hi again all,
I should have added that I am using 2.6.0 and haven't seen any Java
mentioned in the change-log since then...
Cheers,
Rob
> 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
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
--
Robert Haines
Research Associate, RealityGrid Tel. : +44 (0)161 275 6067
Research Computing Services Fax. : +44 (0)161 275 0637
University of Manchester Email: rhaines at manchester.ac.uk
Oxford Road Web : www.realitygrid.org
Manchester, M13 9PL : www.rcs.manchester.ac.uk
More information about the CMake
mailing list