google / google/shaderc

Including shaderc/CMakeLists.txt as suggested in README not working

Open
#1,369 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

I want to use shaderc (including glslc) in my project, such that I can compile glsl shaders (including `#include` directives) in my code.

In the [libshaderc/README.md](https://github.com/google/shaderc/blob/main/libshaderc/README.md) it says:

> If the external project uses CMake, then shaderc/CMakeLists.txt can be included into the external project's CMake configuration and shaderc can be used as a link target. This is the simplest way to use libshaderc in an external project.

So I went ahead and did this:

```
include(3rdparty/shaderc/CMakeLists.txt)
target_link_libraries(${PROJECT_NAME} PRIVATE
shaderc_combined
)
```

But I get the following errors:

> CMake Error at 3rdparty/shaderc/CMakeLists.txt:69 (include):
> include could not find requested file:
>
> cmake/setup_build.cmake

And because of this, other errors (e.g. `Unknwon CMake command "find_host_package"` follow).
It doesn't helpf, if I include these other cmake files in my own CMakeLists.txt either.

My project structure is
```
MyProj
|
|----- CMakeLists.txt
|
|----- 3rdparty/
| |
| | ----- shaderc/CMakeLists.txt
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.