CMAKE_INSTALL_PREFIX environment variable - not working?

Some sources of information 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 enter it and check if the environment variable CMAKE_INSTALL_PREFIX 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 

he is trying to install files in system directories.

If I specify CMAKE_INSTALL_PREFIX as an argument for cmake:

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

then make install works fine - installs files on $KDEDIR

Incorrect documentation about the possibility of setting environment variables with the same name or am I doing something wrong?

+7
source share
2 answers

CMAKE_INSTALL_PREFIX must be set as a CMake variable:

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

But CMake also supports the use of the DESTDIR environment DESTDIR :

 export DESTDIR=/path/to/installation/directory make install 
+7
source

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

+3
source

All Articles