[CMake] Meaning of `*' in find_library()

Robin Verschueren robin.verschueren at gmail.com
Tue Nov 14 06:54:20 EST 2017


Dear all,

I'm having some troubles using the 'PATHS' argument to find_library. More
specifically, I'm trying to find the gfortran libraries (
*/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.so* on my system).

If I call

find_library(FORTRAN_LIBRARY
    NAMES gfortran
    PATHS "/usr/lib/gcc/x86_64-linux-gnu/*")

CMake finds the gfortran libs. However, if I change the last argument to
"usr/lib/gcc/*", CMake does not find the specified library and throws an
error (if REQUIRED is set).

*Why is the extra directory necessary? Does the `*' symbol only look one
directory deeper?  How can I traverse folders recursively?*

I tried to look for documentation on this, but searches in both Google and
the CMake docs did not return anything useful. (looked for find_library,
file, glob, etc.)

Best regards,
Robin

PS if someone knows a better way of finding Fortran libraries, please feel
free to enlighten me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171114/4349b0c7/attachment.html>


More information about the CMake mailing list