# Option default value bug

**URL:** <https://discourse.cmake.org/t/option-default-value-bug/8270>\
**Category:** Code\
**Created:** [June 6, 2023, 7:09pm UTC](https://discourse.cmake.org/t/option-default-value-bug/8270 "2023-06-06T19:09:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mapniv](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@Mapniv](https://discourse.cmake.org/u/Mapniv)\
**Post date:** [June 6, 2023, 7:09pm UTC](https://discourse.cmake.org/t/option-default-value-bug/8270/1 "2023-06-06T19:09:28Z")

</div>

Hello,  
I think I found a bug in cmake. I was redirected here to find out if it is really a bug.

Code:

```auto
cmake_minimum_required(VERSION 3.10)
project(test VERSION 0.0.0)
option(BITS "Bits" 64)
message(STATUS ${BITS})

```

First I prepared the build directory with `rm -r build/*`. Then I ran `cmake -B build -S tree` expecting to see 64 but OFF got printed instead. Does anyone have any idea why? Can you reproduce it?

If I invoke cmake with `cmake -B build -S tree -DBITS=64` then it prints 64.

Tested with cmake version 3.26.4.

---

<div class="post-metadata">

**Author:** ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)\
**Post date:** [June 6, 2023, 7:45pm UTC](https://discourse.cmake.org/t/option-default-value-bug/8270/2 "2023-06-06T19:45:29Z")

</div>

`option` is for boolean values, not number values. You should be using:

```cmake
set (BITS 64 CACHE STRING "Bits")

```
