[CMake] Path vs. name preference during search.

Jean-Christophe Fillion-Robin jchris.fillionr at kitware.com
Thu Feb 13 13:09:20 EST 2014


Hi Rob,

Do address the use case you described, I usually explicitly set the path
the library when built as an external project and rely only on the find_*
command for the use_system case.

See
https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16

Hth
Jc


On Thu, Feb 13, 2014 at 12:51 PM, Rob McDonald <rob.a.mcdonald at gmail.com>wrote:

> 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.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140213/72d6d73b/attachment.html>


More information about the CMake mailing list