Comments (3)
I came across the same issue while using FetchContent with this project and I think I found a solution but it would require to modify the CMakeLists.txt file.
The Vulkan-Headers cmake project does not follow the guidelines to create relocatable packages given in the CMake manual (link).
The solution would be to replace:
target_include_directories(Vulkan-Headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
by:
target_include_directories(Vulkan-Headers INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>" )
Additionally, it would be great to add a cmake cache variable that would control whether the targets defined in this project are added to the install rule. By doing so, projects using FetchContent to add this project to their build could easily set the value themselves. This is done in a lot of projects (namely SDL2 and fmt if I remember correctly).
from vulkan-headers.
It's worth mentioning that if I try to export the targets myself I get the following error:
CMake Error in external/Vulkan-Headers/CMakeLists.txt:
Target "Vulkan-Headers" INTERFACE_INCLUDE_DIRECTORIES property contains
path:
"C:/.../external/Vulkan-Headers/include"
which is prefixed in the source directory.
This is attempting to add a separate export target for vulkan-headers as follows:
install(TARGETS Vulkan-Headers EXPORT Vulkan-HeaderTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include)
install(EXPORT Vulkan-HeaderTargets
FILE vulkanHeadersConfig.cmake
NAMESPACE Vulkan::Headers::
DESTINATION lib/cmake/vulkanheaders)
Or if I try to add it as part of my current export:
install(TARGETS Xlib VulkanHeaders EXPORT XlibTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include)
from vulkan-headers.
It seems that it's possible to circumvent the issue above by using this instead:
get_target_property(VULKAN_HEADERS_INCLUDES Vulkan-Headers INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(
Xlib PUBLIC
$<BUILD_INTERFACE:${VULKAN_HEADERS_INCLUDES}>)
However I'm not sure if this is the proper way of doing this - are there best practices on how to include for install interfaces?
from vulkan-headers.
Related Issues (20)
- Unable to integrate newer versions of Vulkan-Headers due to spurious double quotes in cmake target
- Cross compilation broken HOT 7
- Possible +x bit missing on /usr/share/vulkan/registry/*.py HOT 7
- Setting target_include_directories with generator expression breaks configuration of layers HOT 3
- Deleting old master branch? HOT 4
- [registry] operator precedence in extension dependencies was left undefined HOT 2
- Spelling error in code HOT 2
- v1.3.248 update is incomplete HOT 1
- Set minimal permissions to github workflow
- 1.3.252 generator imports modules existing only in VulkanSC-Headers HOT 7
- Vulkan-Hpp now includes `.cppm` C++20 module; inclusion in Vulkan-Headers HOT 5
- vk_enum_string_helper.h missing HOT 5
- v1.3.257 tag not pointing at main branch HOT 1
- Create a Security Policy HOT 3
- Missing new hpp file vulkan_hpp_macros.hpp HOT 1
- People are trying to run genvk.py out of this repository HOT 7
- Assessment of the difficulty in porting CPU architecture for vulkan-headers HOT 3
- Missing tag for release 1.3.274 HOT 1
- Add new AV1 video headers to BUILD.gn HOT 1
- Set -DVULKAN_HEADERS_ENABLE_MODULE=ON when MSVC 17.11 rolls out to github actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vulkan-headers.