title: CMake, Qt6 - module "QtQuick.Controls" is not installed
body: <p>I'm currently working on learning QtQuick, and I've been running into a variety of issues, but this is the first one I've been unable to solve so far. For background, I'm using MVSC, Visual Studio 2019, CMake, and Qt6.</p>
  <p>​</p>
  <p>Upon running my very basic program, I'm getting the error <code>module &quot;QtQuick.Controls&quot; is not installed</code> on my import statement for QtQuick Controls in the <code>main.qml</code> file I made. The relevant part of the CMakeLists.txt file I'm using is:</p>
  <p>​</p>
  <pre><code>set(CMAKE_CXX_STANDARD 17)
  set(CMAKE_CXX_STANDARD_REQUIRED True)
  
  set(CMAKE_AUTOMOC ON)
  set(CMAKE_AUTORCC ON)
  set(CMAKE_AUTOUIC ON)
  
  find_package(Qt6 COMPONENTS Quick REQUIRED)
  find_package(Qt6 COMPONENTS QuickControls2 REQUIRED)
  find_package(Qt6 COMPONENTS Core REQUIRED)
  find_package(Qt6 COMPONENTS Gui REQUIRED)
  
  qt_add_executable(nameHere
      &quot;src/main.cpp&quot;
      &quot;gui/main.qml&quot;
  )
  
  target_link_libraries(nameHere PRIVATE Qt6::Quick Qt6::QuickControls2)
  
  qt_import_plugins(nameHere QWindowsIntegrationPlugin )
  </code></pre>
  <p>Note: I've got some extra find packages in there from searching for solutions - removing or adding Gui or Core does not change the error</p>
  <p>​</p>
  <p>Upon checking the build folder, these dlls are there:</p>
  <ul>
  <li>Qt6Gui</li>
  <li>Qt6Core</li>
  <li>Qt6Network</li>
  <li>Qt6OpenGL</li>
  <li>Qt6Qml</li>
  <li>Qt6QmlModels</li>
  <li>Qt6Quick</li>
  </ul>
  <p>​</p>
  <p>main.cpp looks like the following:</p>
  <p>​</p>
  <pre><code>#include &lt;QtQuick&gt;
  #include &lt;QtQuickControls2&gt;
  
  int main(int argc, char* argv[])
  {
      QGuiApplication app(argc, argv);
  
      QQuickView* view = new QQuickView;
      view-&gt;setSource(QUrl::fromLocalFile(&quot;../../gui/main.qml&quot;));
      view-&gt;show();
      return app.exec();
  }
  </code></pre>
  <p>The contents of the main.qml file are</p>
  <pre><code>import QtQuick 
  import QtQuick.Controls
  
  ApplicationWindow {
      id: window
      width: 400
      height: 500
      visible: true
  
  }
  </code></pre>
  <p>Once again, the full error is:</p>
  <p>​</p>
  <pre><code>/gui/main.qml:2:1: module &quot;QtQuick.Controls&quot; is not installed
       import QtQuick.Controls
       ^
  /gui/main.qml: module &quot;QtQml.WorkerScript&quot; is not installed
  /gui/main.qml:2:1: module &quot;QtQuick.Controls&quot; is not installed
       import QtQuick.Controls
       ^
  /gui/main.qml: module &quot;QtQml.WorkerScript&quot; is not installed
  </code></pre>
  <p>Any help would be greatly appreciated!</p>
  <hr />
  <p>Some further digging through my vcpkg files indicates there is in fact a Qt6QuickControls2.dll that isn't being placed into the build folder. I'm not a fan of just copy and pasting the file into the build folder. I'm not sure why all of the other Qt dlls are being placed into that folder by CMake, but not this specific dll. Is there something that I'm missing from my CMake file, or could this be a bug with how Qt is set up with CMake?</p>
  <hr />
  <p>As well, just going ahead and copying the QuickControls2 dll file into the folder doesn't actually fix the problem, so I think there is something else going on here.</p>
  <hr />
  <p>Well, in Qt6, QucikControls2 is included in QtQuick, so I'm not sure if it actually needs that extra dll? Not sure what's going on here, but I even went and ran windeployqt, and it says I've already got all of the needed runtime dependencies. Now I have no idea where this issue is coming from.</p>