A question about Qt and vtk

qt6 + vs 2022 + vtk9.4

I create a Qt6 project in Windows. There are two ways to choosed. The first is “Qt visual studio project”,i choose this option ,and write the code, and “RUN”,everything is OK. I call this Project A.

And then , i need to use “CMake” to finish this project. So I choose the second option “CMake project for Qt” When i create another project B,and i copy *.h *.cpp from projectA to project B.

The finally,I write a “CMakeList.txt” like this

cmake_minimum_required(VERSION 3.12.0)
 
project(QProjectA)
 
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)
 
set(CMAKE_PREFIX_PATH E:/Qt/6.2.0/msvc2019_64) 
set(CMAKE_PREFIX_PATH E:/VTK-9.4.1/install) 

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
 
find_package(Qt6 REQUIRED COMPONENTS 
    Core 
    Widgets 
    Gui 
    OpenGL 
    OpenGLWidgets)

set(VTK "E:/VTK-9.4.1/install/lib/cmake/vtk-9.4")
find_package(VTK COMPONENTS 
  CommonCore
  CommonDataModel
  FiltersSources
  GUISupportQt
  InteractionStyle
  RenderingContextOpenGL2
  RenderingCore
  RenderingFreeType
  RenderingGL2PSOpenGL2
  RenderingOpenGL2
  GUISupportQt
  RenderingQt
  REQUIRED
)

if(NOT VTK_FOUND)
  message(FATAL_ERROR "Unable to find the VTK build folder.")
endif()

if(NOT(TARGET VTK::GUISupportQt))
  message(FATAL_ERROR "VTK not built with Qt support.")
endif()
 
set(project_headers QProjectA.h) 
set(project_sources QProjectA.cpp main.cpp)
 
add_executable(${PROJECT_NAME} WIN32 ${project_headers} ${project_sources})
 
target_link_libraries(${PROJECT_NAME}
    PUBLIC
    Qt6::Core
    Qt6::Gui
    Qt6::Widgets
    Qt6::OpenGL
    Qt6::OpenGLWidgets
    ${VTK_LIBRARIES})

I save the CMakeList.txt,everything is OK,and i run “QProjectA.exe”, VisualStudio tell me ERROE like this

无法解析的外部符号 "__declspec(dllimport) public: class vtkColor3d __cdecl vtkNamedColors::GetColor3d(class vtkStdString const &)" (__imp_?GetColor3d@vtkNamedColors@@QEAA?AVvtkColor3d@@AEBVvtkStdString@@@Z),函数 "private: void __cdecl QDemo::creat_vibration(void)" (?creat_vibration@QDemo@@AEAAXXZ) 中引用了该符号

无法解析的外部符号 "__declspec(dllimport) public: static class vtkNamedColors * __cdecl vtkNamedColors::New(void)" (__imp_?New@vtkNamedColors@@SAPEAV1@XZ),函数 "public: __cdecl vtkNew<class vtkNamedColors>::vtkNew<class vtkNamedColors>(void)" (??0?$vtkNew@VvtkNamedColors@@@@QEAA@XZ) 中引用了该符号

Could you tell me what’s wrong in the CMakeList.txt or other place?

Thank you very much

I get it

find_package(VTK COMPONENTS 
  CommonCore
  CommonDataModel
  CommonColor  # if forget this!!
  FiltersSources
  GUISupportQt
  InteractionStyle
  RenderingContextOpenGL2
  RenderingCore
  RenderingFreeType
  RenderingGL2PSOpenGL2
  RenderingOpenGL2
  GUISupportQt
  RenderingQt
  REQUIRED
)