Q:

Cmake option default value

If I have a CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)

OPTION(FOO "Foo Option" OFF)

MESSAGE("FOO? "  ${FOO})

And then I call cmake on it, I get the following output:
FOO?  ON

Why is this?  Haven't I specified the default for FOO is to be OFF? 

A:

Try this:
SET(FOO OFF CACHE BOOL "Foo Option")

or
SET(FOO OFF CACHE BOOL "Foo Option" FORCE)

A:

You may open up cmake gui. It can show you every each option value.  The option value in build folder may different with default value. 
Recheck your CMakeLists.txt file.  Maybe somewhere you set value on it. 
cmake_minimum_required(VERSION 2.8)
OPTION(FOO "Foo Option" OFF)
SET(FOO ON)                   # Don't do this
MESSAGE("FOO? "  ${FOO})

