Comments (2)
find_package relies on packages being built/installed by either a language package manager (vcpkg / conan for example) or a system package manager.
Thanks for the insight.
Looking more into that, it appears there is something new in CMake 3.24 that integrates FetchContent
with find_package
. By adding OVERRIDE_FIND_PACKAGE
to my FetchContent
call and making the name the same as the package, it all magically works!
Fixed sample:
cmake_minimum_required(VERSION 3.24) # <<< update minimum version
...
FetchContent_Declare(
vulkan-headers
GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Headers.git"
GIT_TAG "2634c96" # latest as of writing
)
FetchContent_Declare(
VulkanUtilityLibraries # <<< name same as below
GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git"
GIT_TAG "87801a6" # latest as of writing
OVERRIDE_FIND_PACKAGE) # <<< add this
FetchContent_MakeAvailable(vulkan-headers VulkanUtilityLibraries) # <<< update name
# Vulkan SDK uses find_package to look for this library, and this call now succeeds
find_package(VulkanUtilityLibraries REQUIRED) # <<< this name here
...
from vulkan-utility-libraries.
We do support find_package
. It's actively used in VulkanProfiles and the ValidationLayers at this very moment. We even have tests for it in this repo.
FetchContent does NOT install packages. FetchContent by default clones a repo and calls add_subdirectory on it. IE making it a part of your project.
find_package relies on packages being built/installed by either a language package manager (vcpkg / conan for example) or a system package manager.
IE your example isn't correct.
include(FetchContent)
FetchContent_Declare(
vulkan-headers
GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Headers.git"
GIT_TAG "2634c96" # latest as of writing
)
FetchContent_Declare(
vulkan-utility
GIT_REPOSITORY "https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git"
GIT_TAG "87801a6" # latest as of writing
)
FetchContent_MakeAvailable(vulkan-headers vulkan-utility)
target_link_libraries(add_subdirectory_example PRIVATE
Vulkan::LayerSettings
Vulkan::UtilityHeaders
)
# find_package(VulkanUtilityLibraries REQUIRED) # <<< this call fails because FetchContent doesn't install libraries. You already have the libraries when you called FetchContent_MakeAvailable
from vulkan-utility-libraries.
Related Issues (20)
- The `vk_enum_string_helper.h` problem HOT 1
- Minimize CMake flags developer has to set HOT 3
- Project description missing HOT 2
- Add .gitattributes
- UtilityLibraries accidentally exported stricter warnings HOT 3
- Add Android testing HOT 1
- Export library to standardize compiler/linker options HOT 1
- Ensure consistent usage of `vku` in `PUBLIC` header files.
- `Vulkan::WSI-Config`
- Vulkan SDK Installation HOT 3
- Don't install .clang-format
- Recent GetObjectType additions don't compile on x86 HOT 8
- Add 32 bit builds to CI
- Vulkan Layer Settings: Either flags or string flags
- Add safe struct for VkPushDescriptorSetWithTemplateInfoKHR HOT 1
- Undeclared Identifiers & duplicate case values HOT 14
- feature request: incremental filter assembling HOT 2
- environment variable to save configured settings in a file HOT 5
- Investigate warning or error or debug messages for invalid VkLayerSetting name
- Improve static assert reporting for GetObjectType() in 32 bit environment HOT 2
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-utility-libraries.