KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
2.05k stars 561 forks source link

CMake imported targets: create only one config file and add a namespace #1426

Open SpaceIm opened 4 years ago

SpaceIm commented 4 years ago

Currently, SPIRV-Cross doesn't seem to follow CMake best practices for imported targets:

It means that, when consuming SPIRV-Cross, we have to repeatedly call find_package for each component of SPIRV-Cross, as if they were independant projects, instead of just doing something like:

find_package(SPIRV-Cross REQUIRED spirv-cross-cpp spirv-cross-hlsl CONFIG) # only one config file required (for example SPIRV-Cross-Config.cmake)
add_executable(myapp myapp.cpp)
target_link_libraries(myapp PRIVATE SPIRV-Cross::spirv-cross-cpp SPIRV-Cross::spirv-cross-hlsl) # namespaced imported targets
HansKristian-Work commented 4 years ago

I'm not sure if I want to break existing clients' CMake integration which expect to see CMake targets being exposed in a specific way. As far as I can tell, this is a minor annoyance if anything?