[cmake-developers] CMAKE_INSTALL_PREFIX vs CMAKE_SYSROOT ?

Brad King brad.king at kitware.com
Mon Jul 8 14:44:48 EDT 2013


On 7/4/2013 4:29 AM, Stephen Kelly wrote:
> I can't think of anything that can be done with CMAKE_FIND_ROOT_PATH which 
> can't be done with CMAKE_PREFIX_PATH (with a bit more repetition on the 
> command line, I think). Should we enumerate the use cases to consider 
> documenting it obsolete?

One could have several roots in which target-arch packages
are installed.  CMAKE_FIND_ROOT_PATH can list all of them.
The others are not lists.

> If the install prefix is outside the sysroot,

This seems like a reasonable use case that should have full support.
Isn't your "Goals" example exactly this?

>> We already have
>> 
>>  $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${install_dest}
> 
> Goals:
> * Install to /opt/kf5 on the target
> * Install to $HOME/dev/kf5 on the host
> 
> What values should be used for CMAKE_INSTALL_PREFIX and DESTDIR?

It appears we need several values:

* Prefix on host for host-arch binaries ($HOME/host/kf5? not above)
* Prefix on host for target-arch binaries ($HOME/dev/kf5 above)
* Prefix on target for target-arch binaries (/opt/kf5 above)
* Toolchain sysroot on host (CMAKE_SYSROOT)

Without teaching CMake which targets belong to which category I
do not see how this can be done without project-specific values.

> I think install invokations use CMAKE_HOST_INSTALL_PREFIX for everything if 
> present, and CMAKE_INSTALL_PREFIX otherwise.

Prior to introduction of multiple toolchains I don't see how
this helps.  We only build one architecture at a time, and the
CMAKE_INSTALL_PREFIX says where to install it.

-Brad



More information about the cmake-developers mailing list