# condition comparison in if

**URL:** <https://discourse.cmake.org/t/condition-comparison-in-if/3842>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [July 28, 2021, 6:52am UTC](https://discourse.cmake.org/t/condition-comparison-in-if/3842 "2021-07-28T06:52:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TaddeusPunkt](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@TaddeusPunkt](https://discourse.cmake.org/u/TaddeusPunkt)\
**Post date:** [July 28, 2021, 6:52am UTC](https://discourse.cmake.org/t/condition-comparison-in-if/3842/1 "2021-07-28T06:52:36Z")

</div>

Hi,

i tried to do a short test script to see differences in my system when comparing different conditions.

set(BUILD\_SHARED\_RUNTIME2 TRUE)  
message(STATUS “Boost Linkage Shared: ${BUILD\_SHARED\_RUNTIME2}”)

```auto
if(BUILD_SHARED_RUNTIME2)
	message(STATUS ">>>>>>>>>>>>>>>>>>>>>> Inside bool if")
else()
	message(STATUS ">>>>>>>>>>>>>>>>>>>>>> Inside bool else")
endif()

if(${BUILD_SHARED_RUNTIME2})
	message(STATUS ">>>>>>>>>>>>>>>>>>>>>> Inside {bool} if")
else()
	message(STATUS ">>>>>>>>>>>>>>>>>>>>>> Inside {bool} else")
endif()

```

As a result on my pc i get

```auto
-- Boost Linkage Shared: TRUE
-- >>>>>>>>>>>>>>>>>>>>>> Inside bool if
-- >>>>>>>>>>>>>>>>>>>>>> Inside {bool} else

```

Other pcs get

```auto
-- Boost Linkage Shared: TRUE
-- >>>>>>>>>>>>>>>>>>>>>> Inside bool if
-- >>>>>>>>>>>>>>>>>>>>>> Inside {bool} if

```

Same behaior is with ON/ OFF.

Does someone has an idea if the code or the usage is wrong. Or if my pc has a setting which others do not have? I am really looking forward if someone can bring some light into the dark.

Thanks and Cheers,  
Lars

---

<div class="post-metadata">

**Author:** ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)\
**Post date:** [July 28, 2021, 7:45am UTC](https://discourse.cmake.org/t/condition-comparison-in-if/3842/2 "2021-07-28T07:45:20Z")

</div>

Have a look at policy [CMP0012](https://cmake.org/cmake/help/latest/policy/CMP0012.html).
