# Override system include directories on MacOS

**URL:** <https://discourse.cmake.org/t/override-system-include-directories-on-macos/1850>\
**Category:** Code\
**Tags:** os:macos\
**Created:** [September 16, 2020, 2:14pm UTC](https://discourse.cmake.org/t/override-system-include-directories-on-macos/1850 "2020-09-16T14:14:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MathiasMagnus](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mathiasmagnus/32/431_2.png) [@MathiasMagnus](https://discourse.cmake.org/u/MathiasMagnus)\
**Post date:** [September 16, 2020, 2:14pm UTC](https://discourse.cmake.org/t/override-system-include-directories-on-macos/1850/1 "2020-09-16T14:14:09Z")

</div>

I’m trying to create imported targets to consume OpenCL components. Previously the project relied on `include_directories()` to specify non-system include directories. However, once I moved to installing components as proper imported targets, when I consume `OpenCL::Headers` via `target_link_libraries(example1 PRIVATE OpenCL::Headers)` it picks up the system headers from

```auto
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenCL.framework/Headers/cl.h

```

How can I tell either when creating the imported target (which I install) or when I consume it, that it should take precendence over the system include?

---

<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:** [November 19, 2020, 1:29pm UTC](https://discourse.cmake.org/t/override-system-include-directories-on-macos/1850/2 "2020-11-19T13:29:42Z")

</div>

I suspect that something is not quite correct in the logic of `FindOpenCL` and it is finding `cl.h` from the SDK rather than your version. You might try to influence `OpenCL_INCLUDE_DIR` through the cache or environment.
