On Monday 11 April 2011, Tomasz Grobelny wrote: > On Mon, 11 Apr 2011 09:01:09 -0700, Tyler <[email protected]> wrote: > > On Mon, Apr 11, 2011 at 8:54 AM, Tomasz Grobelny > > > > <[email protected]> wrote: > >> Ok, but is there a way to achieve the same effect so that the user can > >> type just "make install" and not know anything about DESTDIR > > environment > > >> variable (provided he knows about MYDESTDIR)? Maybe it is possible to > > put > > >> this "DESTDIR=$MYDESTDIR" in the generated Makefiles somehow... > > > > If I understand your use case right (which I might not as you haven't > > described what you're trying to do, just how you're trying to do it), > > maybe you can just override CMAKE_INSTALL_PREFIX. > > > > If you go this route, check the archives because of the whole > > _INITIALIZED_TO_DEFAULT aspect of that particular cache variable. > > I already tried playing with CMAKE_INSTALL_PREFIX but the problem was that > value of MYDESTDIR was read (and saved to CMAKE_INSTALL_PREFIX) only when > configuring first time. That's why DESTDIR mechanism comes closer to what > I'm trying to achieve. My use case is something like that: > 1. User has some default MYDESTDIR to non writable location. > 2. User executes "cmake . && make install". > 3. The installation fails because user has no rights to $MYDESTDIR. > 4. User changes MYDESTDIR to another location (writable this time). > 5. User executes "make install" once again and it should succeed. > > Of course the user could set MYDESTDIR to correct location before building > but people often forget that. Now the tricky part is that users are already > used to this mechanism (for particular variable name, called MYDESTDIR > here). So taking different environment variable instead of DESTDIR would > allow me to minimize confusion among users. Otherwise I'll just tell them > to set yet another variable (DESTDIR). But I would like to avoid that if at > all possible.
DESTDIR has a different purpose. Installing to DESTDIR does not necessarily lead to a working and correct installation, mainly when paths are involved, like e.g. RPATH settings. Assuming that CMAKE_INSTALL_PREFIX would be /opt/foo, your executable might get /opt/foo/lib as RPATH, also when installed to $DESTDIR/opt/foo. So they will not have a correct RPATH. You really should set CMAKE_INSTALL_PREFIX. Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
