title: CMake find_library: why are paths in PATHS searched after default paths?
body: <p>CMake documantation seems clear: unless <code>NO_DEFAULT_PATH</code> is specified, cmake proceeds to first search a bunch of default paths, and if the library is not found, <em>only then</em> it looks in the directories listed in <code>PATHS</code>. A few other <code>NO_*</code> exist, to only exclude <em>some</em> of cmake default paths.</p>
  
  <p>I know how to overcome this behavior. E.g., I can do what's suggested <a href="https://stackoverflow.com/a/15773426/1093346">here</a>, namely, do two searches: the first with <code>NO_DEFAULT_PATH</code>, and the second without it. If the first succeeds, the second will be skipped. Win.</p>
  
  <p>However, this question is not about <em>how</em> to achieve what I want (I know the hack). The question is <em>why</em> do I need to do that? Why doesn't cmake look first in the provided paths? It seems logic to me to use those first: if the user is specifying some hints, perhaps I should use those first, and fall back on defaults if they don't work...</p>
  
  <p>Is there a good reason I am missing for the current implementation? I would assume so, I doubt folks down at cmake do things without a good reason...</p>
  
  <p><strong>Edit</strong>: when I said 'the user is specifying some hints', I was not referring to the actual <code>HINTS</code> argument of <code>find_library</code>. It was more of a <em>generic</em> 'hints'. However, as suggested in a comment, <code>HINTS</code> is indeed scanned before system paths. My concern comes from cmake's documentation:</p>
  
  <blockquote>
    <p>Search the paths specified by the HINTS option. These should be paths
    computed by system introspection, such as a hint provided by the
    location of another item already found. Hard-coded guesses should be
    specified with the PATHS option.</p>
  </blockquote>
  
  <p>The fact that <code>HINTS</code> was not designed to receive hard coded full paths, makes me thing it may fire back in the future, so I'm not sure it is the solution. But maybe it is?</p>