[CMake] Check_library_exists don't found a function in a static library

victor sv victorsv at gmail.com
Tue Mar 10 06:02:50 EDT 2015


Hello all,

I'm a newbie using CMake and I'm trying to migrate the compilation of a
fortran project to CMake.

I'm trying to detect the METIS library with find_library(). Inside my
FindMETIS.cmake I want to check the existence of some functions to set the
library version with:

CHECK_LIBRARY_EXISTS(metis METIS_SetDefaultOptions /path/to/metis
VARIABLE_NAME)


If /path/to/metis contains the METIS shared library (libmetis.so) it works
as expected, but if /path/to/metis only contains the static version of the
library (libmetis.a) CHECK_LIBRARY_EXISTS cannot found this function...

I check that the library contains this function with the following result:

$ nm libmetis.a  | grep -i setdefaultoptions
> 0000000000000210 T metis_setdefaultoptions
> 0000000000000220 T metis_setdefaultoptions_
> 0000000000000230 T metis_setdefaultoptions__
>                              U METIS_SetDefaultOptions
> 0000000000000200 T METIS_SETDEFAULTOPTIONS
>                              U METIS_SetDefaultOptions
> 0000000000000030 T METIS_SetDefaultOptions
>

I don't know if this the expected behaviour of this macro, but anyway I
need to do this check in both, shared and static library. How can I do this?

Any help would be appreciated.

Thanks,
Víctor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150310/334ae86b/attachment.html>


More information about the CMake mailing list