Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMAKE_INSTALL_PREFIX environment variable - doesn't work?

Tags:

c++

cmake

Some info sources say:

You can change the installation directory (prefix) by setting the CMAKE_INSTALL_PREFIX environment variable

If i do in a file:

export CMAKE_INSTALL_PREFIX=$KDEDIR

and then source it, and check if CMAKE_INSTALL_PREFIX environment variable is set, when i do:

vic@wic:~/kde/build/kde-workspace$ cmake ../../src/kde-workspace/

and then:

vic@wic:~/kde/build/kde-workspace$ make install

it tries to install files to system directories.

If i specify CMAKE_INSTALL_PREFIX as an argument to cmake:

vic@wic:~/kde/build/kde-workspace$ cmake -DCMAKE_INSTALL_PREFIX=$KDEDIR ../../src/kde-workspace/

then make install works ok - installs files to $KDEDIR

Is the documentation wrong about the possibility to set environment variables with the same name, or am i doing something wrong?

like image 424
warvariuc Avatar asked Aug 07 '12 06:08

warvariuc


2 Answers

CMAKE_INSTALL_PREFIX has to be set as a CMake variable:

cmake -DCMAKE_INSTALL_PREFIX:PATH=/path/to/installation/directory ..

But CMake also supports using the DESTDIR environment variable:

export DESTDIR=/path/to/installation/directory
make install
like image 163
sakra Avatar answered Oct 16 '22 15:10

sakra


CMAKE_INSTALL_PREFIX is a CMake variable, not an environment variable. It can be set with cmake -DCMAKE_INSTALL_PREFIX=yourpath

like image 22
André Avatar answered Oct 16 '22 14:10

André