[CMake] How to link jar files to a library through cmake

ankit jain ankitguddu at gmail.com
Tue Mar 24 00:45:53 EDT 2009


2009/3/20 Robert Haines <rhaines at manchester.ac.uk>

>  I am creating a library through add_library command of java files.
>> Now i want to link it with some jar files which contain some classes which
>> is needed to build that library.
>>
>> target_link_libraries is not working in this case.
>>
>
> As far as I can tell you need to set classpath via include_directories:
>
> include_directories(/path/to/classes /path/to/jars/jar.jar)
>
> See also this bug (including the attached file) for more details:
> http://public.kitware.com/Bug/view.php?id=7832
>
> Java support is pretty weak in CMake at present. It can be forced to
> behave, just, but it's not pleasant. Otherwise, CMake is a great tool!
>
> Cheers,
> Rob
>
>
As you have said i included the jars by include_directories command but it
is still not working because it does not find classes from which these jars
have build.

if i extract the classes from jar and include that folder path then it
works.

But my question is why it is not directly taking it when i give it the path
to jars why i need to extract the files from the jars abnd give its path..
if i extract the classes then what is the need to give path to that jar...

ankit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090324/5a674f81/attachment.htm>


More information about the CMake mailing list