[cmake-developers] CMAKE_INSTALL_PREFIX vs CMAKE_SYSROOT ?

Brad King brad.king at kitware.com
Wed Jul 3 14:42:51 EDT 2013


On 7/3/2013 11:12 AM, Stephen Kelly wrote:
> I can invoke cmake like this:
> 
>  cmake .. -DCMAKE_TOOLCHAIN_FILE=../ArmToolchain.cmake \
>   -DCMAKE_SYSROOT=/home/stephen/rpi/rasp-pi-rootfs/ \
>   -DCMAKE_MAKE_PROGRAM=/usr/bin/make \
>   -DCMAKE_INSTALL_PREFIX=/opt/myproject
> 
> Question: Should the installation be to 
> 
>  /opt/myproject 
> 
> on the host, or to 
> 
>  /home/stephen/rpi/rasp-pi-rootfs/opt/myproject
> 
> on the host?

I view the sysroot as a toolchain thing, not a target root.
If a project wants to install inside the sysroot it can set
CMAKE_INSTALL_PREFIX to point there.  The user may want to
install in $HOME/somewhere while the toolchain sysroot is
a root-owned directory that cannot be modified by the user.

We already have

 $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${install_dest}

so I don't think we need another level.

> However, that leaves the question of how to install outside the sysroot. An 
> option would be something like a new CMAKE_HOST_INSTALL_PREFIX:

How do install() invocations distinguish which prefix to use?
Does this tie into your multi-toolchain work?

-Brad



More information about the cmake-developers mailing list