Setting CMake variables in default.cmake files

The orocos-XXX.default.cmake file currently only in RTT (but I've
patches in for the other projects), requires forced cache variables
sometimes. This is not mentioned anywhere in the default.cmake file. I
think we should add an additional commented entry indicating that this
is required.

These do not work

SET(CMAKE_INSTALL_PREFIX /path/to/nowhere)
SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "")

but this one does

SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "" FORCE)

Demonstrated on Ubuntu with CMake 2.6.2

Stephen

Setting CMake variables in default.cmake files

On Fri, Aug 7, 2009 at 02:46, S Roderick<kiwi [dot] net [..] ...> wrote:
> The orocos-XXX.default.cmake file currently only in RTT (but I've
> patches in for the other projects), requires forced cache variables
> sometimes. This is not mentioned anywhere in the default.cmake file. I
> think we should add an additional commented entry indicating that this
> is required.
>
> These do not work
>
> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere)
> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "")
>
> but this one does
>
> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "" FORCE)
>
> Demonstrated on Ubuntu with CMake 2.6.2

I grepped through the source and couldn't find RTT modifying the
CMAKE_INSTALL_PATH. So this means cmake requires us to set it like
that?

Maybe we need to set it earlier, maybe before the PROJECT definition ?

Peter

Setting CMake variables in default.cmake files

On Aug 10, 2009, at 09:05 , Peter Soetens wrote:

> On Fri, Aug 7, 2009 at 02:46, S Roderick<kiwi [dot] net [..] ...> wrote:
>> The orocos-XXX.default.cmake file currently only in RTT (but I've
>> patches in for the other projects), requires forced cache variables
>> sometimes. This is not mentioned anywhere in the default.cmake
>> file. I
>> think we should add an additional commented entry indicating that
>> this
>> is required.
>>
>> These do not work
>>
>> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere)
>> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "")
>>
>> but this one does
>>
>> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "" FORCE)
>>
>> Demonstrated on Ubuntu with CMake 2.6.2
>
> I grepped through the source and couldn't find RTT modifying the
> CMAKE_INSTALL_PATH. So this means cmake requires us to set it like
> that?
>
> Maybe we need to set it earlier, maybe before the PROJECT definition ?

Yep, before the PROJECT def fixes it. Minor change - need to use $
{CMAKE_SOURCE_DIR} then too, not PROJ_SOURCE_DIR.
S

Setting CMake variables in default.cmake files

On Aug 10, 2009, at 09:05 , Peter Soetens wrote:

> On Fri, Aug 7, 2009 at 02:46, S Roderick<kiwi [dot] net [..] ...> wrote:
>> The orocos-XXX.default.cmake file currently only in RTT (but I've
>> patches in for the other projects), requires forced cache variables
>> sometimes. This is not mentioned anywhere in the default.cmake
>> file. I
>> think we should add an additional commented entry indicating that
>> this
>> is required.
>>
>> These do not work
>>
>> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere)
>> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "")
>>
>> but this one does
>>
>> SET(CMAKE_INSTALL_PREFIX /path/to/nowhere CACHE PATH "" FORCE)
>>
>> Demonstrated on Ubuntu with CMake 2.6.2
>
> I grepped through the source and couldn't find RTT modifying the
> CMAKE_INSTALL_PATH. So this means cmake requires us to set it like
> that?
>
> Maybe we need to set it earlier, maybe before the PROJECT definition ?
>
> Peter
I played with this some, but not exhaustively. I will try it before
the PROJECT def, but I suspect you are right in that it needs to be
set on the command line.

If this truly is an exception, I'd like to add it (commented out) in
the orocos-rtt.defaults.cmake file so that people know it is
different. That's all this post is about. Should do same for the other
projects too.
S