title: Cannot use Qt Charts - QT6 | Cmake
body: <p>I am using Qt 6.2.1 with cmake and I can't find a way to use Qt Charts.</p>
  <p>The Qt Charts is installed under &quot;C:\Qt\6.2.1\Src\qtcharts&quot;</p>
  <p>In my cmakelists.txt I've included the Qt Charts in find_package and target_link_libraries. That seemed to work on qt5 (found on other answers in StackOverflow) but don't work on qt6. (I've hidden the project sources files)</p>
  <pre><code>cmake_minimum_required(VERSION 3.5)
  
  project(projectname VERSION 0.1 LANGUAGES CXX)
  
  set(CMAKE_INCLUDE_CURRENT_DIR ON)
  
  set(CMAKE_AUTOUIC ON)
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_AUTORCC ON)
  
  set(CMAKE_CXX_STANDARD 11)
  set(CMAKE_CXX_STANDARD_REQUIRED ON)
  
  set(CMAKE_CXX_FLAGS_DEBUG &quot;/MDd&quot;)
  
  find_package(QT NAMES Qt6 COMPONENTS Widgets Charts REQUIRED)
  find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Xml Widgets REQUIRED)
  
  set(PROJECT_SOURCES
          ...
  )
  
  if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
      qt_add_executable(projectname
          MANUAL_FINALIZATION
          ${PROJECT_SOURCES}
      )
  else()
      add_executable(projectname 
          ${PROJECT_SOURCES}
      )
  endif()
  
  target_link_libraries(projectname PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Xml Qt6::Charts)
  
  if(QT_VERSION_MAJOR EQUAL 6)
      qt_finalize_executable(projectname)
  endif()
  </code></pre>
  <p>I get this error:</p>
  <pre><code>C:\Qt\6.2.1\msvc2019_64\lib\cmake\Qt6Core\Qt6CoreMacros.cmake:559: error: Target &quot;projectname&quot; links to target &quot;Qt6::Charts&quot; but the target was not found.  Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing? C:/Qt/6.2.1/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:523 (_qt_internal_create_executable) C:/Qt/6.2.1/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:847 (qt6_add_executable) CMakeLists.txt:78 (qt_add_executable)
  </code></pre>