[CMake] Re: CMAKE_INSTALL_PREFIX and DESTDIR

Fernando Cacciola fernando.cacciola at gmail.com
Fri Feb 22 10:19:54 EST 2008


Fernando Cacciola wrote:
> string( LENGTH "$ENV{DESTDIR}" DESTDIRLEN )
>
> if ( ${DESTDIRLEN} GREATER 0 )
>  message( STATUS "DESTDIR specified ($ENV{DESTDIR}). Overriding
> CMAKE_INSTALL_PREFIX (${CMAKE_INSTALL_PREFIX})" )
>  set( CMAKE_INSTALL_PREFIX "" CACHE PATH "Use DESTDIR *instead* of
> CMAKE_INSTALL_PREFIX" FORCE )
> endif()
>
In fact, that only works if the script needs to be processed again, which is 
seldom the case of "make install".
So in practice this doesn't work.

Any ideas?

Is there a way to tell whether CMAKE_INSTALL_PREFIX has its default magic 
value or has it been defined by the user?
If so I could reset the "deault" to nothing, which makes more sense IMO.

I would like not to have my users remember to manually 
add -DCMAKE_INSTALL_PREFIX="" at configuration time to use DESTDIR later on.

Best


-- 
Fernando Cacciola
SciSoft
http://fcacciola.50webs.com
http://groups.google.com/group/cppba





More information about the CMake mailing list