[CMake] Path vs. name preference during search.

Rob McDonald rob.a.mcdonald at gmail.com
Thu Feb 13 12:51:46 EST 2014


When I search for a given library, specifying multiple possible names and
multiple hints for paths...

FIND_LIBRARY( FINDME_LIB
        NAMES name1 name2 name3
        HINTS path1 path2 path3
        DOC "Library to find")

CMake seems to have a preference for name1, and it first searches all HINTS
for name1.  If it doesn't find name1, it moves to name2 and then searches
all HINTS for name2, etc.

I would prefer to have a preference for path1, no matter the name.  Try for
all names in path1, then move to path2, etc.

Is there a way to toggle this behavior?

Rob


Background...  Basically, I am using ExternalProject_Add to build a
library.  However, to make it possible to use the system-library instead,
this is optional.  I use a FindThelib.cmake so the main project works
seamlessly either way.

I'm targeting the case where a version of this library is installed on the
system, but I want to use my own copy.

The name of the library depends on build options and platform, so
controlling on the name is a little fragile.  However, I have explicitly
built it in a known directory, so having preference for the known directory
is desirable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140213/14342b75/attachment.html>


More information about the CMake mailing list