2009/4/19 Philip Lowman <phi...@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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to