[CMake] set CMAKE_INSTALL_PREFIX in CMakeLists

Micha Renner Micha.Renner at t-online.de
Tue Nov 23 09:37:41 EST 2010


Am Dienstag, den 23.11.2010, 15:01 +0100 schrieb Michael Wild:
> On 11/23/2010 02:33 PM, Micha Renner wrote:
> > Am Dienstag, den 23.11.2010, 14:01 +0100 schrieb tomasoni at sbc.su.se:
> >> Dear Cmake users,
> >>
> >> 1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file with
> >> SET(CMAKE_INSTALL_PREFIX, "my/path")
> >                          ^
> >                      No comma!
> > 
> > greetings
> > Micha
> 
> And *NEVER EVER* set CMAKE_INSTALL_PREFIX in your CMakeLists.txt file.
> That is a user-setting and you will make people angry at you if you
> override their choice in your code.

Okay, then this might help:

IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
	SET(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Foo install
		 prefix" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

Of course, this is not my idea. It had someone from kitware, I don't
remember who it was.


greetings
Micha





More information about the CMake mailing list