# What's the history behind choosing -D to pass cache variables on the command line

**URL:** https://discourse.cmake.org/t/whats-the-history-behind-choosing-d-to-pass-cache-variables-on-the-command-line/5014
**Category:** Development
**Created:** [February 15, 2022, 3:14pm UTC](https://discourse.cmake.org/t/whats-the-history-behind-choosing-d-to-pass-cache-variables-on-the-command-line/5014 "2022-02-15T15:14:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![alcroito](https://discourse.cmake.org/user_avatar/discourse.cmake.org/alcroito/32/186_2.png) [@alcroito](https://discourse.cmake.org/u/alcroito)
#### Post date: [February 15, 2022, 3:14pm UTC](https://discourse.cmake.org/t/whats-the-history-behind-choosing-d-to-pass-cache-variables-on-the-command-line/5014/1 "2022-02-15T15:14:54Z")

</div>

I was wondering if anyone knew why was `-D` chosen as the option used to pass cache variable on the command line.  
Was it simply because -D is used by compiler frontends to pass preprocessor definitions, and that sort of maps to variables in CMake, which are close enough in meaning?  
Or was it an arbitrary decision?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [February 15, 2022, 3:25pm UTC](https://discourse.cmake.org/t/whats-the-history-behind-choosing-d-to-pass-cache-variables-on-the-command-line/5014/2 "2022-02-15T15:25:07Z")

</div>

Well, I don’t “know” but quite naturally it comes from “Define”.

I guess if the meaning is obvious depends on how you look at the “action” it’s performing. If you say “passing cache variables”, “D” may seem weird. It makes sense if you say “define variables”, though.

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [February 15, 2022, 5:25pm UTC](https://discourse.cmake.org/t/whats-the-history-behind-choosing-d-to-pass-cache-variables-on-the-command-line/5014/3 "2022-02-15T17:25:21Z")

</div>

> [@alcroito](#):
>
> because -D is used…to pass preprocessor definitions, and that sort of maps…?

Yes.
