I am trying to use a vcpkg port (“vulkan-headers”) and their usage instruction didn’t work.
Well it does work (find_package find the port) if I do find_package(VulkanHeaders CONFIG REQUIRED) in a CMakelist but fails if I do it in an included cmake file like /Project/CMake/VulkanDependencies.cmake
Is that an expected behaviour?
I am doing find_packages for other ports like GTest and those are working. so I am inclined to say it is an issue with the port itself?
I found the issue, find_package was called before the call to project.
The output of debug-find didn’t contain the path to the vcpkg installed directory.
I wish the cmake command that can’t be called before project would error out on it. Or at least be documented. I have been bitten way too often by just moving around include cmake file and breaking the build.
Maybe this issue is with vcpkg. I mean maybe find_package can be called before project but not for vcpkg package? I don’t know enough on the internals here.
Ya it makes sense, when include file does the find_package to bring in dependencies, it is easy when moving around the include directive to fall into this trap.