# How to set the usage requirements (includes) for current project

**URL:** <https://discourse.cmake.org/t/how-to-set-the-usage-requirements-includes-for-current-project/10865>\
**Category:** Code\
**Created:** [May 17, 2024, 11:24am UTC](https://discourse.cmake.org/t/how-to-set-the-usage-requirements-includes-for-current-project/10865 "2024-05-17T11:24:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oodini](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/db5fbb/32.png) [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Post date:** [May 17, 2024, 11:24am UTC](https://discourse.cmake.org/t/how-to-set-the-usage-requirements-includes-for-current-project/10865/1 "2024-05-17T11:24:04Z")

</div>

Hello,

I have a library project, whose code and the main CMakeLists.txt are a **src** directory.  
The root contains a CMakeLists.txt with some general settings and the `install()` stuff.

Thanks to the `install()` commands, the clients have to include .h as I wish (MyLib is added by the install process):  
`#include <MyLib/SubDir/SomeFile.h`

But I’d like also the MyLib sources can include the .h in the same way (even if there is not MyLib directory). I suppose I should use ALIAS, but I am not sure how to use it.

Note my sources are defined by `FILE SET`, so I don’t use the `target_include_directories()` command.

---

<div class="post-metadata">

**Author:** ![Angew](https://discourse.cmake.org/user_avatar/discourse.cmake.org/angew/32/229_2.png) [@Angew](https://discourse.cmake.org/u/Angew)\
**Post date:** [May 17, 2024, 12:03pm UTC](https://discourse.cmake.org/t/how-to-set-the-usage-requirements-includes-for-current-project/10865/2 "2024-05-17T12:03:34Z")

</div>

> [@Oodini](#):
>
> But I’d like also the MyLib sources can include the .h in the same way (even if there is not MyLib directory)

I don’t think that’s possible, and it’s definitely not something CMake could do on its own. How `#include` directives are processed is up to the compiler (its preprocessor, to be exact). If there is a way to “fake” directories in `#include` directives, it will be documented in the compiler’s docs.

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [May 17, 2024, 9:42pm UTC](https://discourse.cmake.org/t/how-to-set-the-usage-requirements-includes-for-current-project/10865/3 "2024-05-17T21:42:37Z")

</div>

Use the same directory structure in your source tree that you want to use when installed. That is basically what the `FILE_SET` functionality is assuming you are doing, with the path below a BASE\_DIRS controlling the header’s installed location and matching what consumers will need to `#include`.

---

<div class="post-metadata">

**Author:** ![Oodini](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/o/db5fbb/32.png) [@Oodini](https://discourse.cmake.org/u/Oodini)\
**Post date:** [May 18, 2024, 2:53pm UTC](https://discourse.cmake.org/t/how-to-set-the-usage-requirements-includes-for-current-project/10865/4 "2024-05-18T14:53:23Z")

</div>

OK, thank you !
