[CMake] FIND_* search paths

E. Wing ewmailing at gmail.com
Wed Jan 4 19:23:13 EST 2006


So what is the default going to do if you omit (forget) specifying the
CMAKE_SYSTEM_*_DIRECTORIES? This will probably be the common case (for
legacy scripts, people not in the loop on the new feature).


For custom/internal use scripts, these new variables seem reasonable,
but for public/general consumption scripts (e.g. the Find*.cmake
scripts in the Modules directory), I think these just pass the buck of
the search order problem from CMake to the CMake scripters without
really solving anything. So I think a good default is needed
(particularly in the case of omission) and perhaps a user-configurable
switch is also needed.

My personal approach to public modules is to throw in everything that
I know exists for the major platforms/distributions I know about. My
intent is to make it very easy for a newbie to get going in one step
if possible. (In fact, most of my colleagues don't have the patience
to want to learn or setup a CMake build system so I can't make it more
than one easy step before I lose them.) Most of the time I can't know
what their desired search order is (though I can make some guesses
with things like OS X frameworks since generally you have to go out of
your way to get a framework).

>From what I have observed, most users do not set their environment
paths, especially the CMAKE_*_PATHs because they don't know about them
(or how to set them in some cases). Furthermore, typically it's only
the advanced users that would think about using environmental
variables to try to specify search paths. I think in most cases, if
the list of paths doesn't contain what advanced users want to use,
they will use environmental variables as an override, which lead
directly to their desired dependencies, which makes going through the
list of paths redundant for them. So my personal opinion is that I
think a good general default behavior is to allow for this override
facility by making the CMAKE_SYSTEM_*_DIRECTORIES searched first.

But it's hard to please everybody, so maybe there needs to be yet
another CMake switch that toggles the default search order for
CMAKE_SYSTEM_*_DIRECTORIES between first and last (configurable though
the GUI or command line arguments).

But if a script explicitly lists the ${CMAKE_SYSTEM_*_DIRECTORIES},
that order should be respected instead and exclusively, which allows
scripters with good knowledge of their build system and users to
better fine tune their stuff for their purposes.

Thanks,
Eric


More information about the CMake mailing list