<pre class="lang-cpp prettyprint-override"><code>add_subdirectory(SPIRV-Cross)
target_link_libraries(${PROJECT_NAME} INTERFACE spirv-cross-c)
</code></pre>
<p>this worked hope this helps my fellow newbies.</p>

CC BY-SA 4.0
2024-04-23T13:22:01.660Z
2024-04-23T13:23:05.663Z
2024-04-23T13:23:05.663Z
GloriousDemonFist
<p><a href="https://github.com/KhronosGroup/SPIRV-Cross" rel="nofollow noreferrer">SPIRV Cross</a></p>
<p>How do I include this in my project
I added this to my packages folder</p>
<pre class="lang-cpp prettyprint-override"><code>add_subdirectory(SPIRV-Cross)
find_package(spirv_cross_c_shared)
if (spirv_cross_c_shared_FOUND)
        message(STATUS &quot;Found SPIRV-Cross C API! :)&quot;)
else()
        message(STATUS &quot;Could not find SPIRV-Cross C API! :(&quot;)
endif()

target_link_libraries(${PROJECT_NAME} INTERFACE spirv-cross-c-shared)
</code></pre>
<p>iam getting this error
<code>out\build\x64-debug\LINK : fatal error LNK1104: cannot open file 'spirv-cross-c-shared.lib</code></p>
<p>usually doing this work
<code>add_subdirectory()</code>
<code>target_link_libraries()</code>
but not in this case.
I have added a lot of library to my project but this seems to not work.</p>
<p>also cmake in cmake</p>
<pre><code>1&gt; [CMake] -- SPIRV-Cross: Git hash: fa5ca34+
1&gt; [CMake] SPIRV-Cross:  Testing will be disabled for SPIRV-Cross. Could not find glslang or SPIRV-Tools build under external/. To enable testing, run ./checkout_glslang_spirv_tools.sh and ./build_glslang_spirv_tools.sh first.
1&gt; [CMake] CMake Warning at ExternalLibrary/CMakeLists.txt:85 (find_package):
1&gt; [CMake]   By not providing &quot;Findspirv_cross_c_shared.cmake&quot; in CMAKE_MODULE_PATH this
1&gt; [CMake]   project has asked CMake to find a package configuration file provided by
1&gt; [CMake]   &quot;spirv_cross_c_shared&quot;, but CMake did not find one.
1&gt; [CMake] 
1&gt; [CMake]   Could not find a package configuration file provided by
1&gt; [CMake]   &quot;spirv_cross_c_shared&quot; with any of the following names:
1&gt; [CMake] 
1&gt; [CMake]     spirv_cross_c_sharedConfig.cmake
1&gt; [CMake]     spirv_cross_c_shared-config.cmake
1&gt; [CMake] 
1&gt; [CMake]   Add the installation prefix of &quot;spirv_cross_c_shared&quot; to CMAKE_PREFIX_PATH
1&gt; [CMake]   or set &quot;spirv_cross_c_shared_DIR&quot; to a directory containing one of the
1&gt; [CMake]   above files.  If &quot;spirv_cross_c_shared&quot; provides a separate development
1&gt; [CMake]   package or SDK, be sure it has been installed.
</code></pre>
<p>what is the correct way to add the this</p>

<vulkan>
How to include SPIRV in a CMake project
GloriousDemonFist
# How to include SPIRV in a CMake project

(Asked by: username_0 on 2024-04-22)

[SPIRV Cross](https://github.com/KhronosGroup/SPIRV-Cross)

How do I include this in my project
I added this to my packages folder

```cpp
add_subdirectory(SPIRV-Cross)
find_package(spirv_cross_c_shared)
if (spirv_cross_c_shared_FOUND)
        message(STATUS "Found SPIRV-Cross C API! :)")
else()
        message(STATUS "Could not find SPIRV-Cross C API! :(")
endif()

target_link_libraries(${PROJECT_NAME} INTERFACE spirv-cross-c-shared)

```

iam getting this error
`out\build\x64-debug\LINK : fatal error LNK1104: cannot open file 'spirv-cross-c-shared.lib`

usually doing this work
`add_subdirectory()`
`target_link_libraries()`
but not in this case.
I have added a lot of library to my project but this seems to not work.

also cmake in cmake

```
1> [CMake] -- SPIRV-Cross: Git hash: fa5ca34+
1> [CMake] SPIRV-Cross:  Testing will be disabled for SPIRV-Cross. Could not find glslang or SPIRV-Tools build under external/. To enable testing, run ./checkout_glslang_spirv_tools.sh and ./build_glslang_spirv_tools.sh first.
1> [CMake] CMake Warning at ExternalLibrary/CMakeLists.txt:85 (find_package):
1> [CMake]   By not providing "Findspirv_cross_c_shared.cmake" in CMAKE_MODULE_PATH this
1> [CMake]   project has asked CMake to find a package configuration file provided by
1> [CMake]   "spirv_cross_c_shared", but CMake did not find one.
1> [CMake] 
1> [CMake]   Could not find a package configuration file provided by
1> [CMake]   "spirv_cross_c_shared" with any of the following names:
1> [CMake] 
1> [CMake]     spirv_cross_c_sharedConfig.cmake
1> [CMake]     spirv_cross_c_shared-config.cmake
1> [CMake] 
1> [CMake]   Add the installation prefix of "spirv_cross_c_shared" to CMAKE_PREFIX_PATH
1> [CMake]   or set "spirv_cross_c_shared_DIR" to a directory containing one of the
1> [CMake]   above files.  If "spirv_cross_c_shared" provides a separate development
1> [CMake]   package or SDK, be sure it has been installed.

```

what is the correct way to add the this

**Tags:** vulkan


---

## 1 answers

### Answer by username_0 on 2024-04-23. Score: 1

```cpp
add_subdirectory(SPIRV-Cross)
target_link_libraries(${PROJECT_NAME} INTERFACE spirv-cross-c)

```

this worked hope this helps my fellow newbies.


---

