KhronosGroup / KhronosGroup/SPIRV-Tools

CMake config file: create only one config file for all targets and add a namespace

Open
#3,559 0 comments 0 reactions 0 assignees View on GitHub
dev:building
Dominant language
C++
Stars
1.4k
Forks
709
Avg merge
1d 22h
Merged PRs (30d)
28

Description

Currently, SPIRV-Tools exports one config file per target, and these imported targets aren't namespaced.

Therefore, assuming for example a project directly depending on each component of SPIRV-Tools, it would do something like this:

```cmake
find_package(SPIRV-Tools CONFIG REQUIRED)
find_package(SPIRV-Tools-opt CONFIG REQUIRED)
find_package(SPIRV-Tools-link CONFIG REQUIRED)
find_package(SPIRV-Tools-reduce CONFIG REQUIRED)
target_link_libraries(myapp1 PRIVATE SPIRV-Tools)
target_link_libraries(myapp2 PRIVATE SPIRV-Tools-opt)
target_link_libraries(myapp3 PRIVATE SPIRV-Tools-link)
target_link_libraries(myapp4 PRIVATE SPIRV-Tools-reduce)
```

while best practices would be to have only one config file and namespaced imported targets:

```cmake
find_package(SPIRV-Tools CONFIG REQUIRED SPIRV-Tools SPIRV-Tools-opt SPIRV-Tools-link SPIRV-Tools-reduce)
target_link_libraries(myapp1 PRIVATE SPIRV-Tools::SPIRV-Tools)
target_link_libraries(myapp2 PRIVATE SPIRV-Tools::SPIRV-Tools-opt)
target_link_libraries(myapp3 PRIVATE SPIRV-Tools::SPIRV-Tools-link)
target_link_libraries(myapp4 PRIVATE SPIRV-Tools::SPIRV-Tools-reduce)
```

Contributor guide

Open the contributing guide

Research direction

The issue does not name specific files or tests. Start by locating the CMake package export and config-generation logic for SPIRV-Tools targets, then trace how each component currently creates its config file. Done means one package config can expose all requested targets under the SPIRV-Tools namespace, with dependent projects using the single find_package pattern shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.