According to the cmake documentation:
Provides an option for the user to select as ON or OFF
However, I noticed that the command works with any other values.
My test script:
cmake_minimum_required (VERSION 2.6)
option(MY_VAR "var description" OFF)
message("MY_VAR=${MY_VAR}")
if(MY_VAR)
message("MY_VAR is not OFF/FALSE/0")
endif()
Results:
>cmake ..
or
>cmake -DMY_VAR=OFF ..
output:
MY_VAR=OFF
>cmake -DMY_VAR=ON ..
output:
MY_VAR=ON
MY_VAR is not OFF/FALSE/0
>cmake -DMY_VAR=FALSE ..
output:
MY_VAR=FALSE
>cmake -DMY_VAR=TRUE ..
output:
MY_VAR=TRUE
MY_VAR is not OFF/FALSE/0
>cmake -DMY_VAR=0 ..
output:
MY_VAR=0
>cmake -DMY_VAR=1 ..
output:
MY_VAR=1
MY_VAR is not OFF/FALSE/0
cmake -DMY_VAR=3 ..
output:
MY_VAR=3
MY_VAR is not OFF/FALSE/0