Skip to content

Commit 0453d0c

Browse files
authored
Merge pull request #20 from rsps/add-dump-all
Add var_dump_all()
2 parents 4e1847f + 334399d commit 0453d0c

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
* `var_dump_all()` macro in `debug.cmake`.
13+
1014
### Changed
1115

1216
* Reformatted release (_version_) headings in `CHANGELOG.md`.

cmake/rsp/debug.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ if (NOT COMMAND "var_dump")
204204
endfunction()
205205
endif ()
206206

207+
if (NOT COMMAND "var_dump_all")
208+
209+
#! var_dump_all : Outputs human-readable information about CMake's current defined variables
210+
#
211+
# @see https://cmake.org/cmake/help/latest/prop_dir/VARIABLES.html#variables
212+
#
213+
macro(var_dump_all)
214+
# Get the global VARIABLES
215+
# @see https://cmake.org/cmake/help/latest/prop_dir/VARIABLES.html#variables
216+
get_cmake_property(_global_vars VARIABLES)
217+
list (SORT _global_vars)
218+
219+
foreach (_var "${_global_vars}")
220+
var_dump(PROPERTIES ${_var})
221+
endforeach()
222+
endmacro()
223+
endif ()
224+
207225
if(NOT COMMAND "build_info")
208226

209227
#! build_info : Output build information to stdout or stderr (Cmake's message type specific)

docs/+current/modules/debug/dump.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,34 @@ Outputs:
196196

197197
```txt
198198
my_list = (string 15) "foo;bar;42;true"
199+
```
200+
201+
## `var_dump_all()`
202+
203+
**Available Since: `v0.2.0`**
204+
205+
Outputs human-readable information about CMake's current defined variables.
206+
207+
_See Cmake's [`VARIABLES`](https://cmake.org/cmake/help/latest/prop_dir/VARIABLES.html) for additional information._
208+
209+
```cmake
210+
var_dump_all()
211+
```
212+
213+
Outputs:
214+
215+
```txt
216+
ALERT_LEVEL = (command, cached) ALERT_LEVEL()
217+
BUILD_TESTING = (string 0) ""
218+
CMAKE_AUTOGEN_ORIGIN_DEPENDS = (string 2) "ON"
219+
CMAKE_AUTOMOC_COMPILER_PREDEFINES = (string 2) "ON"
220+
CMAKE_AUTOMOC_MACRO_NAMES = (list 4) [
221+
0: (string 8) "Q_OBJECT"
222+
1: (string 8) "Q_GADGET"
223+
2: (string 11) "Q_NAMESPACE"
224+
3: (string 18) "Q_NAMESPACE_EXPORT"
225+
]
226+
CMAKE_AUTOMOC_PATH_PREFIX = (string 3) "OFF"
227+
228+
... remaining not shown
199229
```

0 commit comments

Comments
 (0)