# get/print the value of variables

**URL:** https://discourse.cmake.org/t/get-print-the-value-of-variables/4001
**Category:** Usage
**Created:** [August 31, 2021, 11:03am UTC](https://discourse.cmake.org/t/get-print-the-value-of-variables/4001 "2021-08-31T11:03:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Master\_Andreas](https://discourse.cmake.org/user_avatar/discourse.cmake.org/master_andreas/32/1339_2.png) [@Master\_Andreas](https://discourse.cmake.org/u/Master_Andreas)
#### Post date: [August 31, 2021, 11:03am UTC](https://discourse.cmake.org/t/get-print-the-value-of-variables/4001/1 "2021-08-31T11:03:02Z")

</div>

I am looking for a way to get the value of CMAKE variables  
specifically i want to see the value of `CMAKE_CXX_FLAGS_DEBUG` and `CAME_CXX_FLAGS_RELWITHDEBINFO`

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [August 31, 2021, 2:31pm UTC](https://discourse.cmake.org/t/get-print-the-value-of-variables/4001/2 "2021-08-31T14:31:53Z")

</div>

I believe you’re looking for the `message` command:

```cmake
message("varname: ${varname}")

```

---

<div class="post-metadata">

### Author: ![Master\_Andreas](https://discourse.cmake.org/user_avatar/discourse.cmake.org/master_andreas/32/1339_2.png) [@Master\_Andreas](https://discourse.cmake.org/u/Master_Andreas)
#### Post date: [August 31, 2021, 2:48pm UTC](https://discourse.cmake.org/t/get-print-the-value-of-variables/4001/3 "2021-08-31T14:48:12Z")

</div>

Thanks and for those who are curious

```auto
CMAKE_CXX_FLAGS_DEBUG: -g
CMAKE_CXX_FLAGS_RELWITHDEBINFO: -O2 -g -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE: -O3 -DNDEBUG

```
