# How does CMake parse and execute its lists and modules

**URL:** https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734
**Category:** Usage
**Created:** [February 28, 2020, 4:55pm UTC](https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734 "2020-02-28T16:55:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![satrapes](https://discourse.cmake.org/user_avatar/discourse.cmake.org/satrapes/32/377_2.png) [@satrapes](https://discourse.cmake.org/u/satrapes)
#### Post date: [February 28, 2020, 4:55pm UTC](https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734/1 "2020-02-28T16:55:01Z")

</div>

Hello,  
I am trying to understand how does CMake go through CMakeLists.txt files and .cmake files to produce the output in order to fix a bug in my cmake code.

Can someone help?

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [February 28, 2020, 6:32pm UTC](https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734/2 "2020-02-28T18:32:48Z")

</div>

If you want to examine the line-by-line execution of commands, you can run `cmake --trace`.

---

<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: [February 28, 2020, 8:50pm UTC](https://discourse.cmake.org/t/how-does-cmake-parse-and-execute-its-lists-and-modules/734/3 "2020-02-28T20:50:59Z")

</div>

`--trace-expand` can show you the full line that gets executed as well (rather than just dumping out the “I’m going to expand this variable” without showing what it actually does expand to).
