cmake generated package cause bug while the source code is correct

I have implement some code, and want to generate myself package.

My CMakeLists.txt looks like:

...

install(TARGETS pA pB ...
	EXPORT SustaoBasic
	RUNTIME DESTINATION bin
	LIBRARY DESTINATION lib
	ARCHIVE DESTINATION lib
)

install(DIRECTORY package/ DESTINATION include
	FILES_MATCHING PATTERN "*.h"
)

install(EXPORT SustaoBasic
	FILE SustaoBasic.cmake
	NAMESPACE SustaoBasic::
	DESTINATION lib/cmake
)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
	SustaoBasicConfigVersion.cmake
	VERSION V1.0
	COMPATIBILITY AnyNewerVersion  # 表示该函数库向下兼容
)

configure_package_config_file(
	SustaoBasicConfig.cmake.in ${PROJECT_BINARY_DIR}/SustaoBasicConfig.cmake
	INSTALL_DESTINATION lib/cmake
)

install(FILES "${PROJECT_BINARY_DIR}/SustaoBasicConfig.cmake"
              "${PROJECT_BINARY_DIR}/SustaoBasicConfigVersion.cmake"
        DESTINATION lib/cmake)

I can sucessfully generate myself package. However, bug is reported when I use it.

I use it by:

find_package(SustaoBasic)
target_link_libraries(Pro SustaoBasic::DataObject)

After building, vs reported: can not open VTK::GUISupportQtSQL.lib. It really make me confuzed.

  1. I think the original SustaoBasic::DataObject do not link to VTK::GUISupportQtSQL.lib, because my built VTK package do not open VTK_GUISupportQtSQL:

    And I can not find vtkGUISupportQtSQL.lib in my VTK package after searching all qt relatived lib:

  2. The project has no bug when I use the source code of SustaoBasic. Where is this bug from when I use find_package() to load SustaoBasic::DataObject?

Any suggestion is appreciated~~~

I suspect that your SustaoBasicConfig.cmake file needs to do find_package(VTK) itself to make VTK’s imported targets available to consumers of your targets as well.

The VTK::GUISupportQtSQL.lib may be caused because I use find_package(VTK REQUIRED) in my SustaoBasic package. I have modified all find_package(VTK REQUIRED) to find_package(VTK COMPONENTS CommonCore ...), and the bug is fixed.