Is it possible to see what targets are imported and how?

Hi.

I have a very strange problem I am unable to solve. In a project of
mine, I have a dependency on VulkanSceneGraph which, when built it
produces a vsg::vsg target. VulkanSceneGraph depends on Vulkan::Vulkan.
So when you find_package(vsg REQUIRED) it also looks for Vulkan::Vulkan.
In the configuration step, the find_package(vsg REQUIRED) call doesn’t
complain. But when in generation step it fails saying the following

CMake Error at /lib/cmake/vsg/vsgTargets.cmake:56 (set_target_properties):
The link interface of target “vsg::vsg” contains:

 Vulkan::Vulkan

but the target was not found. Possible reasons include:

 * There is a typo in the target name.
 * A find_package call is missing for an IMPORTED target.
 * An ALIAS target is missing.

The contents of vsgTargets.cmake in line 56 are:

53: # Create imported target vsg::vsg
54: add_library(vsg::vsg STATIC IMPORTED)
55:
56: set_target_properties(vsg::vsg PROPERTIES
57: INTERFACE_INCLUDE_DIRECTORIES “${_IMPORT_PREFIX}/include”
58: INTERFACE_LINK_LIBRARIES
“Vulkan::Vulkan;Threads::Threads;glslang::MachineIndependent;glslang::OSDependent;glslang::OGLCompiler;glslang::SPIRV;glslang::GenericCodeGen;glslang::SPIRV-Tools-opt;glslang::SPIRV-Tools”
59: )

I can’t really understand why this fails. I wonder if Vulkan::Vulkan
doesn’t actually exist and something else is created/imported like just
Vulkan. Hence my question. Is there a way to debug CMake internals so
that we can see what targets are in play when configuring and generating?

Otherwise, any other suggestion about how to debug/fix this or to
understand what is going on here is very much appreciated.

Thank you!

You can pass --debug-find to cmake to get extra details about what find_package(vsg REQUIRED) does.

The config file for vsg should include find_package(Vulkan) in some way. The find_dependency command from the FindDependencyMacro module is probably of interest here.