[CMake] option() behavior
Eric Noulard
eric.noulard at gmail.com
Sun Apr 19 13:56:05 EDT 2009
2009/4/19 Philip Lowman <philip at yhbt.com>:
> I encountered this the other day. Is this a bug?
I don't think so.
More comment inside code:
> project(Foo)
> cmake_minimum_required(VERSION 2.6)
> set(WTFO ON)
You define the WTFO which is not cached.
> message("WTFO is ${WTFO}")
> option(WTFO "wtfo" OFF)
Now you define an option with the same name which is a variable but CACHED.
> message("WTFO is ${WTFO}")
>
> Here's the output...
>
> (first run)
> WTFO is ON
> WTFO is OFF
First run shows you the var value.
Then the option overwrite the uncached var with its default value, i.e. OFF.
> (second run)
> WTFO is ON
You set the cached variable to ON, thus the value is "ON" but now it
reached the cache.
> WTFO is ON
Your option retrieve it's value from the cache.
I think the "bug" is that you may define an option which overwrite an
uncached var.
--
Erk
More information about the CMake
mailing list