<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58918>58918</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Expose clang resource/include directory through CMake variable
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tristan957
      </td>
    </tr>
</table>

<pre>
    I am using libclang to parse C source files. Given a small program like:

```c
#include <stddef.h>

int main(void)
{
  size_t hello = 5;
  return hello;
}
```

libclang should report `fatal error: 'stddef.h' file not found`.

On my system (Fedora 36), the resource directory is located:

```shell
$ clang -print-resource-dir
/usr/lib64/clang/14.0.5
```

Which means the include directory is located at `$(clang -print-resource-dir)/include)`. The clang cmake modules already expose a variable called `CLANG_INCLUDE_DIRS`, but the only directory exposed in this variable is `$CMAKE_INSTALL_PREFIX/include`, which isn't helpful for what I need.

Ideally these constants would be exposed in a cross buildsystem way like https://github.com/llvm/llvm-project/issues/9777, but I am willing to settle for just appending to the `CLANG_INCLUDE_DIRS` array since that should be as little effort as possible to solve what I need.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVMuOnDgU_RrYXDXiUUDVgkWnHlFpOplRHprZtQy-FE4MRn5UT83XzzUUlUqUziISwoZrH59zfOxa8Ut1BNaDM2I4gRR1Ixl1rIKRaYOwBaOcbhBaIdFE8FaccQAGpmdSwqjVSdNsKb5ikD0G8S6Il3cRz09z_U4zMTTScYQg2xrLObZRF2T7-0lisNAzMQTp-qwED9LNtVq-mTsARvyHzxY6lFIR0g7yILsVNVqnh7l4-x2Uux8o3S95k2w65SQniFFpCzSqZZZJQK2VJm0QpOWNdVpOfsCgLLTKDZyGR_eofw7QX8BcjMWeZq4PyJVmkBVeUroF2yGtdLWWC42NVfoCwoBUDbPIX3PTeG2LoyuYqT-Mmpx7WAAfCHAZcnBG05tUFitqp_HUJqsojvJf2PJ3J5oOemSDmcgue_czrsAmv4gPKX2dkVd-uOL4D7IMPhH0PKPp2VeEXnFHOQMmNTJ-Afx3VJRCBmemBavJ8oZyR0vS7O3T4_u3z8f326fPu_3z7vjh40RiC7WzE2c1yMsd4RmLkxSqEvsbJPVn-tt3j3_sCfHjp8enp-e_PuwPx3_uOM_oL5MzwlBIyymHY-skpUBThYw4woDIvwvDkSORvnhOpKVRg7FssAZepsDVeM-MQaOVMaRBSH7Nzwu7TCcMOmtH45ORHug5Cdu5OmpU7zdYnpeGvFdfSLNnboxDQ51NWZaLNdN5fxFSivmgG7SWXPAKvjhjgY0jDvxa9D6-5jUwrYka3RwUYuvFX88QSWKUDjHhYtv6A0U_SKQR3nC_qJJn_M6xEKukKNZJvCqTIuRVxjfZhoVWEEi1n3MwR2VJ1betudtl22nlTh1s3_k8LXscOi2r37cvX2-SddhVvCmTMl3HPGFNuyqwKNJVlm5YnWcMy6IIJatRmirI3wT5LhRVGqdpkiRxsk7zpIiSul035aZGTiCM5cEqRrrvZOQXjpQ-hbqaONTuZKgohbHmW5GRfycya8FnznZKV1YLn6hNXoYT42qi-z_k6N5T">