[CMake] set CMAKE_INSTALL_PREFIX in CMakeLists
Marcel Loose
loose at astron.nl
Wed Nov 24 05:52:51 EST 2010
>>> On 23-11-2010 at 15:37, in message
<1290523061.2001.8.camel at gildemeister-2>,
Micha Renner <Micha.Renner at t-online.de> wrote:
> 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
Hi Micha,
I would prefer to use
SET(CMAKE_INSTALL_PREFIX "/foo/bar" CACHE PATH "Foo install prefix")
So, without the test to CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
and without the FORCE option.
Reason: if someone unsets CMAKE_INSTALL_PREFIX on the command-line with
-U, CMAKE_INSTALL_PREFIX will default to /foo/bar (which is the
project's default), instead of /usr/local (which is CMake's default).
Just my 2cts.
Marcel Loose.
More information about the CMake
mailing list