[CMake] find_library search orders with CMAKE_PREFIX_PATH & CMAKE_FIND_ROOT_PATH
David Cole
david.cole at kitware.com
Wed May 23 14:29:04 EDT 2012
Regarding the loop swapping you ask about in your original post:
I know we've discussed swapping those loops before on this list, quite to
exhaustion.
The bottom line is: we will not be changing those loops so as to preserve
existing behavior. If we do add code to swap those loops, then it would
have to be conditionally activated, only in response to people requesting
it by explicitly setting a variable (or some equivalent mechanism).
I don't know how far back this discussion was, but it's in the archives.
(If anybody can provide a pointer to the exact thread, that would be
great...)
HTH,
David
On Wed, May 23, 2012 at 2:22 PM, Nicolas Tisserand <
nicolas.tisserand at gmail.com> wrote:
> On Wed, May 23, 2012 at 1:01 AM, Eric Noulard <eric.noulard at gmail.com>
> wrote:
> > I'm not sure I understand, doesn't the
> > -DCMAKE_FIND_ROOT_PATH:PATH=/Users/nt/Hacks/cmake-find-png/stage
> > -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY:STRING=ONLY
> > case gives you want you want:
>
> Yes, I forgot to clarify that point. It does not work for me either,
> because it completely discards all system libraries (like libm.dylib
> or CoreFoundation.framework on the mac, for instance), which makes it
> difficult to build anything useful without copying or symbolic-linking
> all the system libraries in the stage/lib directory.
>
> What I would need is simply to have the custom-built libraries take
> precedence over their potential system-wide versions.
>
> > This is the case (at least for find_library) if you look at
> > Source/cmFindLibraryCommand.cxx
> > std::string cmFindLibraryCommand::FindNormalLibrary()
>
> Thanks for the tip :-)
>
> >> My use case would require the inner and outer loops to be swapped.
> >
> > This looks like a reasonable request to me but I can't imagine a way
> > to support that without adding some option like "PATH_FIRST" to
> > find_library.
>
> This would be nice but would require to edit the find_library calls in
> the build system of all the custom-built libraries, which is not very
> desirable, because I do not maintain them.
>
> Could something like
> -DCMAKE_FIND_ROOT_PATH_MODE_{PROGRAM,INCLUDE,LIBRARY}:STRING=FIRST be
> envisioned instead? That way, I could trigger the correct build
> through command line switches, without intrusive editions.
>
> > Again could you explain why the
> >
> > -DCMAKE_FIND_ROOT_PATH:PATH=/Users/nt/Hacks/cmake-find-png/stage
> > -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY:STRING=ONLY
> > does not work for you?
>
> Yeah, sure. As stated above, it restricts the set of libraries
> available through find_library to the exact contents of the stage
> directory, thus completely discarding some required standard
> libraries.
>
> --
> Nicolas
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120523/96997c97/attachment.htm>
More information about the CMake
mailing list