Isolate VulkanHppGenerator and VideoHppGenerator in CMakeLists.txt
envgap__KhronosGroup__Vulkan-Hpp-2037
01 / FAILURE SIGNATURE
As reported upstream
Fetching as shown will result in the following error during configuration:
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
ed47b1d9ad5d78a2b428517f41e275c13ccdb764- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
KhronosGroup/Vulkan-Hpp #2037 · read the original issue
When adding the vulkan-hpp CMake project (e.g. through FetchContent), people may sometimes want to merely access the headers under `vulkan/` and therefore only need access to the interface library providing the correct include directory:
```cmake
FetchContent_Declare(vulkan-hpp
GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Hpp.git"
GIT_TAG "v1.4.303"
GIT_SHALLOW ON
GIT_SUBMODULES ""
OVERRIDE_FIND_PACKAGE
EXCLUDE_FROM_ALL
SYSTEM)
FetchContent_MakeAvailable(vulkan-hpp)
```
As the submodules are not necessary for this, the VulkanHppGenerator and VideoHppGenerator targets will not be set up properly (even when not used), as the `TINYXML2_SOURCES` are missing, prompting CMake to complain about not knowing what language the target should be in:
https://github.com/KhronosGroup/Vulkan-Hpp/blob/752778463e89c27677aecaf18cf80449c12ad603/CMakeLists.txt#L366-L383
Fetching as shown will result in the following error during configuration:
```
[cmake] CMake Error at build/_deps/vulkan-hpp-src/CMakeLists.txt:367 (add_executable):
[cmake] Cannot find source file:
[cmake]
[cmake] build/_deps/vulkan-hpp-src/tinyxml2/tinyxml2.cpp
[cmake]
[cmake] Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm
[cmake] .ccm .cxxm .c++m .h .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90
[cmake] .f95 .f03 .hip .ispc
[cmake]
[cmake]
[cmake] CMake Error at build/_deps/vulkan-hpp-src/CMakeLists.txt:367 (add_executable):
[cmake] No SOURCES given to target: VulkanHppGenerator
[cmake]
[cmake]
[cmake] CMake Error at build/_deps/vulkan-hpp-src/CMakeLists.txt:374 (add_executable):
[cmake] No SOURCES given to target: VideoHppGenerator
[cmake]
[cmake]
[cmake] CMake Generate step failed. Build files cannot be regenerated correctly.
```
It would be nice if these two targets could be hidden behind an if condition or some function, making this repo a convenient way to fetch a specific header version, rather than always generate the bindings.
The current solution is to set `SOURCE_SUBDIR "disabled"` to disable the cmake configuration for this project and adding `vulkan-hpp_SOURCE_DIR` as an include directory, which works but is not as nice as having access to an INTERFACE target, especially when wanting to use the c++20 module04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]