<div dir="ltr">Jc,<div><br></div><div>That is an approach I have thought about.  I even think I have looked at Slicer for how you work your CMake system.</div><div><br></div><div>I prefer to use project-supplied FindLIB.cmake (or a slightly modified version thereof) because some of them do more than just setting LIBRARY, INCLUDE_DIR, and FOUND variables.</div>
<div><br></div><div>Rather than duplicate everything done in the FindLIB.cmake script (which can have platform-dependent logic), I have gone the path of encouraging the FindLIB.cmake to find the one I want.</div><div><br>
</div><div>Rob</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Feb 13, 2014 at 10:09 AM, Jean-Christophe Fillion-Robin <span dir="ltr"><<a href="mailto:jchris.fillionr@kitware.com" target="_blank">jchris.fillionr@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Rob, <br><br></div>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.<br>


<br>See <a href="https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16" target="_blank">https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16</a><br>


<br></div><div>Hth<br></div><div>Jc<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Feb 13, 2014 at 12:51 PM, Rob McDonald <span dir="ltr"><<a href="mailto:rob.a.mcdonald@gmail.com" target="_blank">rob.a.mcdonald@gmail.com</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">When I search for a given library, specifying multiple possible names and multiple hints for paths...<div>


<br></div><div><div>FIND_LIBRARY( FINDME_LIB</div><div>        NAMES name1 name2 name3</div><div>        HINTS path1 path2 path3</div>
<div>        DOC "Library to find")</div></div><div><br></div><div>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.</div>



<div><br></div><div>I would prefer to have a preference for path1, no matter the name.  Try for all names in path1, then move to path2, etc.</div><div><br></div><div>Is there a way to toggle this behavior?</div><div><br>


</div>
<div>Rob</div><div><br></div><div><br></div><div>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.</div>



<div><br></div><div>I'm targeting the case where a version of this library is installed on the system, but I want to use my own copy.</div><div><br></div><div>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.</div>



</div>
<br></div></div>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br>
<br clear="all"><br>-- <br><a href="tel:%2B1%20919%20869%208849" value="+19198698849" target="_blank">+1 919 869 8849</a><br>
</font></span></div>
</blockquote></div><br></div>