# How to get C system header search directories?

**URL:** https://discourse.cmake.org/t/how-to-get-c-system-header-search-directories/5683
**Category:** Usage
**Created:** [May 17, 2022, 8:12pm UTC](https://discourse.cmake.org/t/how-to-get-c-system-header-search-directories/5683 "2022-05-17T20:12:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tomoreilly](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/t/439d5e/32.png) [@tomoreilly](https://discourse.cmake.org/u/tomoreilly)
#### Post date: [May 17, 2022, 8:12pm UTC](https://discourse.cmake.org/t/how-to-get-c-system-header-search-directories/5683/1 "2022-05-17T20:12:03Z")

</div>

How to get the C system header directories, e.g. where does gcc look to find a system header file ("`#include <someSystemHeader>`")? I have a very short test file:

```auto
cmake_minimum_required(VERSION 3.18)
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_C_STANDARD 11)

message("CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES: ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
message("CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")

```

Running ‘cmake -P’ shows both variables are empty:

```auto
$ cmake -P test.cmake
CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES: 
CMAKE_SYSTEM_PREFIX_PATH:

```

I expect these variables to contain at least “/usr/include” and “/usr/local/include”. What am I missing?

Thanks!

---

<div class="post-metadata">

### Author: ![benthevining](https://discourse.cmake.org/user_avatar/discourse.cmake.org/benthevining/32/1924_2.png) [@benthevining](https://discourse.cmake.org/u/benthevining)
#### Post date: [May 17, 2022, 9:38pm UTC](https://discourse.cmake.org/t/how-to-get-c-system-header-search-directories/5683/2 "2022-05-17T21:38:44Z")

</div>

In script processing mode it’s not surprising those aren’t defined, since cmake doesn’t actually enable any compilers. Try printing those variables in an actual project.
