# Manually-specified variables were not used by the project:

**URL:** <https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321>\
**Category:** Code\
**Created:** [August 23, 2022, 4:51pm UTC](https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321 "2022-08-23T16:51:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TorstenRobitzki](https://discourse.cmake.org/user_avatar/discourse.cmake.org/torstenrobitzki/32/881_2.png) [@TorstenRobitzki](https://discourse.cmake.org/u/TorstenRobitzki)\
**Post date:** [August 23, 2022, 4:51pm UTC](https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321/1 "2022-08-23T16:51:04Z")

</div>

Hello,  
I have the need to pass a binary option to my build process. I pass the option as cache variable:

```
cmake ... -DMY_OPTION=1

```

Within one of the `CMakeLists.txt`, I ask for the existence of this parameter:

```
if (DEFINED MY_OPTION)

```

This works as expected, but I will see the warning:

```
CMake Warning:
  Manually-specified variables were not used by the project:

    MY_OPTION

```

This behavior was already reported ([https://gitlab.kitware.com/cmake/cmake/-/issues/18152](https://gitlab.kitware.com/cmake/cmake/-/issues/18152)). Is there an other, more obvious ways to pass binary options, that would not trigger the warning?

---

<div class="post-metadata">

**Author:** ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)\
**Post date:** [August 23, 2022, 8:02pm UTC](https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321/2 "2022-08-23T20:02:53Z")

</div>

If you only check for the existence of `MY_OPTION`, then it seems that passing `-DMY_OPTION=1` and passing `-DMY_OPTION=0` mean the same. Is that intended?

---

<div class="post-metadata">

**Author:** ![TorstenRobitzki](https://discourse.cmake.org/user_avatar/discourse.cmake.org/torstenrobitzki/32/881_2.png) [@TorstenRobitzki](https://discourse.cmake.org/u/TorstenRobitzki)\
**Post date:** [August 23, 2022, 8:06pm UTC](https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321/3 "2022-08-23T20:06:19Z")

</div>

Yes, I need just 2 different values: true or false. As the cmake command line parser requires me to set a value, any value would do the job.

---

<div class="post-metadata">

**Author:** ![McMartin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mcmartin/32/150_2.png) [@McMartin](https://discourse.cmake.org/u/McMartin)\
**Post date:** [August 23, 2022, 8:13pm UTC](https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321/4 "2022-08-23T20:13:12Z")

</div>

If you need 2 values, then you should use `if(MY_OPTION)` instead of `if(DEFINED MY_OPTION)`.

---

<div class="post-metadata">

**Author:** ![TorstenRobitzki](https://discourse.cmake.org/user_avatar/discourse.cmake.org/torstenrobitzki/32/881_2.png) [@TorstenRobitzki](https://discourse.cmake.org/u/TorstenRobitzki)\
**Post date:** [August 30, 2022, 2:01pm UTC](https://discourse.cmake.org/t/manually-specified-variables-were-not-used-by-the-project/6321/5 "2022-08-30T14:01:50Z")

</div>

Hi Alain,  
I’m sorry for the late response! And thank you for the suggested solution to my problem. Seems to work very well!

best regards,  
Torsten
