[CMake] (no subject)

Matt Wilbur wilburm at gmail.com
Thu Jan 2 21:53:51 EST 2014


On Thu, Jan 2, 2014 at 10:20 AM, Magnus Therning <magnus at therning.org>wrote:

> On Thu, Jan 02, 2014 at 12:14:38AM -0500, Matt Wilbur wrote:
> > With a bit of thought and source code reading, I sorted this out.
> > Let me know if you'd like me to post my answer to my own question.
>
> Yes, please do.
>
> I'm sure you've found yourself in the very irritating situation where
> you're looking for the answer to some question, but all you can find
> is other people asking the same question in various fora.  By
> answering your own question you'll help other people avoid that
> irritating situation when they are looking around for an answer to
> this particular question. :)
>

Very good point.

So, the flaw in my understanding was that the ONLY_CMAKE_FIND_ROOT_PATH |
NO_CMAKE_FIND_ROOT_PATH | CMAKE_FIND_ROOT_PATH_BOTH had no effect if
NO_DEFAULTS is used.

NO_DEFAULTS only affects the construction of the list of paths to be
searched.  i.e. NO_DEFAULTS means the list of paths to be searched consists
only of the paths specified by the PATHS argument (maybe others - haven't
looked into that one).  Point is, all the find_XXX commands construct a
list of paths to be searched, consisting of what is specified in the
command plus maybe some other paths.

The effect of ONLY_CMAKE_FIND_ROOT_PATH | NO_CMAKE_FIND_ROOT_PATH |
CMAKE_FIND_ROOT_PATH_BOTH (and, similarly CMAKE_FIND_ROOT_PATH_MODE_*) is
to determine how that list of search paths is further processed to create
the final list of paths searched by CMake.

Call the initial list of paths to be searched InitialSearchPaths.  Call
RerootedSearchPaths the result of prepending each element of
CMAKE_FIND_ROOT to each element of InitialSearchPaths.  In Clojure (since
I've been playing with it in my personal time and it succinctly captures
the list processing):

(flatten (for [r CMAKE_FIND_ROOT] (map #(str r %) InitialSearchPaths)))

The actual list of search paths, SearchPaths would be one of

IntitalSearchPaths
RerootedSearchPaths
(concat RerootedSearchPaths  IntitalSearchPaths)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140102/fdd66082/attachment.htm>


More information about the CMake mailing list