MantisBT - CMake
View Issue Details
0011704CMakeCMakepublic2011-01-15 20:492016-06-10 14:31
Maddes 
Bill Hoffman 
normalmajoralways
closedmoved 
MinG/GCCWindows XPXP SP3
CMake 2.8.3 
 
0011704: [mingw32] mingw32-make install: CMAKE_INSTALL_PREFIX and DESTDIR issue
Behaviour of CMake for "mingw32-make install" of MinGW is a little bit weird as DESTDIR doesn't replace value from CMAKE_INSTALL_PREFIX, although DESTDIR support is told to be supported in FAQ.

"mingw32-make install" without DESTDIR works as expected, it uses CMAKE_INSTALL_PREFIX (here CMake default).

"mingw32-make install" with DESTDIR does not work as expected, it uses both in conjunction leading to weird destination folders with MinGW.
> cmake -G "MinGW Makefiles"
...

> mingw32-make
...

> mingw32-make install
Install the project...
-- Install configuration: ""
-- Installing: C:/Program Files (x86)/PINPROC/lib/libpinproc.a
-- Up-to-date: C:/Program Files (x86)/PINPROC/include/p-roc/pinproc.h

> mingw32-make install DESTDIR="E:\TEMP\TEST"
Install the project...
-- Install configuration: ""
-- Installing: E:/TEMP/TEST/Program Files (x86)/PINPROC/lib/libpinproc.a
-- Installing: E:/TEMP/TEST/Program Files (x86)/PINPROC/include/p-roc/pinproc.h
No tags attached.
Issue History
2011-01-15 20:49MaddesNew Issue
2011-01-15 20:54MaddesNote Added: 0024723
2011-01-15 20:54MaddesNote Edited: 0024723bug_revision_view_page.php?bugnote_id=24723#r129
2011-01-15 21:44Bill HoffmanNote Added: 0024724
2011-01-15 21:44Bill HoffmanAssigned To => Bill Hoffman
2011-01-15 21:44Bill HoffmanStatusnew => assigned
2011-01-16 02:21Eric NOULARDNote Added: 0024725
2011-01-16 07:09MaddesNote Added: 0024727
2011-01-16 07:10MaddesNote Edited: 0024727bug_revision_view_page.php?bugnote_id=24727#r131
2011-01-16 07:10MaddesNote Edited: 0024727bug_revision_view_page.php?bugnote_id=24727#r132
2016-06-10 14:28Kitware RobotNote Added: 0041779
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0024723)
Maddes   
2011-01-15 20:54   
Tried to workaround by setting CMAKE_INSTALL_PREFIX to the most simple relative path: ".".
But again it shows the same behaviour.

> cmake -DCMAKE_INSTALL_PREFIX:PATH="." -G "MinGW Makefiles"
...

> mingw32-make
...

> mingw32-make install
Install the project...
-- Install configuration: ""
-- Installing: D:/Coding/pinproc/maddes-dev/bin/mingw5/./lib/libpinproc.a
-- Installing: D:/Coding/pinproc/maddes-dev/bin/mingw5/./include/p-roc/pinproc.h

> mingw32-make install DESTDIR="E:\TEMP\TEST"
Install the project...
-- Install configuration: ""
-- Installing: E:/TEMP/TEST/Coding/pinproc/maddes-dev/bin/mingw5/./lib/libpinproc.a
-- Installing: E:/TEMP/TEST/Coding/pinproc/maddes-dev/bin/mingw5/./include/p-roc/pinproc.h

P.S.:
If I remember correctly CMake always converts relative pathes to absolute pathes, due to cross compiling support.

(0024724)
Bill Hoffman   
2011-01-15 21:44   
That is the way DESTDIR is supposed to work... DESTDIR a way to install a tree that can then be relocated. Most common on unix, something like this:

make DESTDIR=~/mystage install

Where CMAKE_INSTALL_PREFIX=/usr/local

It will install into ~/mystage/usr/local then you create a tar file from ~/mystage and move the install tree onto the system location at a later point. The tar file will have usr/local as the root, and if you untar it at / as root then it will end up at the right place.
(0024725)
Eric NOULARD   
2011-01-16 02:21   
As Bill said,
The behavior you are observing is the expected one

see http://www.gnu.org/prep/standards/html_node/DESTDIR.html [^] too.

However what are you trying to do?

If you want to install your software at alternate locate you can either
  1) configure with the wanted CMAKE_INSTALL_PREFIX
  2) build a relocatable installer (NSIS) and use it to install the software
(0024727)
Maddes   
2011-01-16 07:09   
(edited on: 2011-01-16 07:10)
It's just an unusual behaviour on Windows, as there are no defined structures like /usr[/local]/lib, etc. on Unix/Linux.

Got a workaround by setting CMAKE_INSTALL_PREFIX to C:\.
Maybe not the best but at least I can install the libs and the exes in the dirs I want to.

Thanks for the clarification.

(0041779)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.