[cmake-developers] CMAKE_PREFIX_PATH v. <PKG>_ROOT_DIR (was: Volunteering to maintain a new module: FindGSL.cmake)

Brad King brad.king at kitware.com
Tue Dec 2 14:19:39 EST 2014


On 12/02/2014 02:08 PM, Rolf Eike Beer wrote:
> Brad King wrote:
>> On 12/02/2014 12:06 PM, Thompson, KT wrote:
> 
>>> #  GSL_ROOT_DIR       - The top level directory of the discovered GSL
>>> #                       install (useful if GSL is not in a standard
>>> location)
>> This and the other singular names should be documented as variables
>> that are used as hints or to record results.
> 
> I wonder if this is needed at all. Isn't CMAKE_PREFIX_PATH enough?

I've long touted CMAKE_PREFIX_PATH as a generic solution that
avoids the need for per-package _ROOT_DIR variables.  However,
it was originally intended just to provide a way to configure
user-specific search prefixes.  This makes sense when lots of
packages are installed into a few user-specific prefixes.  On
platforms like Windows, though, it is very common to have a
separate prefix for every package.

It is less convenient to pass a whole list of package roots
to CMAKE_PREFIX_PATH than it is to specify separate _ROOT_DIR
variables for each package.  This is especially true in cmake-gui
when a dialog can be used to find a single root directory.  I
think this is why people tend to create _ROOT_DIR variables in
their find modules.

-Brad



More information about the cmake-developers mailing list