[CMake] How to check/set CMAKE_INSTALL_PREFIX
Brad King
brad.king at kitware.com
Mon Oct 16 14:02:28 EDT 2006
Eric Noulard wrote:
> What is the good way to change the default value of CMAKE_INSTALL_PREFIX
> besides the usual:
This question has come up several times and I've been deferring a fix
until a project-specified initial cache feature is implemented. That
feature has been delayed because it is tricky.
I've just added a fix to CVS CMake for this. It will be in 2.4.4 (the
upcoming patch release). Basically your code needs to know whether the
current value of CMAKE_INSTALL_PREFIX was set by the user on the command
line or initialized by CMake. Now when CMake initializes the variable
it also sets CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT to true. This
enables projects to change the default install prefix like this:
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX
"/opt/foo" CACHE PATH "FOO install prefix" FORCE
)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-Brad
More information about the CMake
mailing list