Git Product home page Git Product logo

Comments (2)

kroppt avatar kroppt commented on August 21, 2024 1

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.

juan-lunarg avatar juan-lunarg commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.