[CMake] Confusion about CMAKE_INSTALL_PREFIX

Eric Noulard eric.noulard at gmail.com
Sat May 26 02:11:44 EDT 2012


2012/5/26 vivek goel <goelvivek2011 at gmail.com>:
> I am building another program inside my cmake which usage autotools for
> generating it's make file.
>
> I want to run it's configure like ./configure
> --prefix=${CMAKE_INSTALL_PREFIX}.
> But when I am  changing the DESTDIR for my project. CMAKE_INSTALL_PREFIX is
> not getting changed.
> So everytime configure is running as
> ./configure --prefix=/usr/local
> Is it a bug ?
> or Should I use DESTDIR variable instead of using CMAKE_INSTALL_PREFIX
> or Should I set -DCMAKE_INSTALL_PREFIX whenever I am changing DESTDIR.
>
> What is the recommended way ?

Both, but for different purpose.

CMAKE_INSTALL_PREFIX should be used to control install prefix at
**CONFIGURE time**
whereas
DESTDIR is an **INSTALL time**  mechanism.

so you can perfectly do:

cmake -DCMAKE_INSTALL_PREFIX=/usr/local
and
make install ---> install things under /usr/local

whereas
make DESTDIR=/home/vivek  install
--> install things under /home/vivek/usr/local


-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list