title: plugin cannot be loaded for module "QtQuick" (CMake)
body: <p>I have installed Qt using vcpkg and successfully managed to get a QtWidgets application working.</p>
  <p>I created a default QtQuick application using QtCreator and the QtCreator Qt binaries and it runs just fine. However, when transferring over to VS Code (which is using vcpkg for its Qt binaries) I get the following error in my console and the application exits:</p>
  <pre><code>QQmlApplicationEngine failed to load component
  qrc:/main.qml:1:1: plugin cannot be loaded for module &quot;QtQuick&quot;: Cannot load library F:\Projects\Dev\Qt-Creator\QtQuickCMakeTest-vscode\build\MSVC-2019-x64\Debug\Debug\qml\QtQuick.2\qtquick2plugind.dll: The specified module could not be found.
  </code></pre>
  <p>However when navigating to the specified location, the file &quot;qtquick2plugind.dll&quot; is indeed there. Looking in the debug console of VS Code I get the following:</p>
  <pre><code>Loaded 'F:\Projects\Dev\Qt-Creator\QtQuickCMakeTest-vscode\build\MSVC-2019-x64\Debug\Debug\qml\QtQuick.2\qtquick2plugind.dll'. Symbols loaded.
  Unloaded 'F:\Projects\Dev\Qt-Creator\QtQuickCMakeTest-vscode\build\MSVC-2019-x64\Debug\Debug\qml\QtQuick.2\qtquick2plugind.dll'.
  </code></pre>
  <p>Why is it loading and unloading the qtquick2plugind.dll? I assuming the loading process is failing, but why?</p>
  <p>Here is my CMakeLists.txt, although it is exactly the same as the default Qt Creator one for Qt Quick, except I am passing a path to my vcpkg toolchain which CMake ultimately uses to find Qt.</p>
  <pre><code>cmake_minimum_required(VERSION 3.5)
  
  project(QtQuickCMakeTest 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)
  
  # QtCreator supports the following variables for Android, which are identical to qmake Android variables.
  # Check http://doc.qt.io/qt-5/deployment-android.html for more information.
  # They need to be set before the find_package(Qt5 ...) call.
  
  #if(ANDROID)
  #    set(ANDROID_PACKAGE_SOURCE_DIR &quot;${CMAKE_CURRENT_SOURCE_DIR}/android&quot;)
  #    if (ANDROID_ABI STREQUAL &quot;armeabi-v7a&quot;)
  #        set(ANDROID_EXTRA_LIBS
  #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
  #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
  #    endif()
  #endif()
  
  find_package(Qt5 COMPONENTS Core Quick QuickControls2 QuickTemplates2 REQUIRED)
  
  message(STATUS &quot;CURRENT VAR ${Qt5_DIR}&quot;)
  
  if(ANDROID)
      add_library(QtQuickCMakeTest SHARED
        main.cpp
        qml.qrc
      )
  else()
      add_executable(QtQuickCMakeTest
        main.cpp
        qml.qrc
      )
  endif()
  
  target_compile_definitions(QtQuickCMakeTest
    PRIVATE $&lt;$&lt;OR:$&lt;CONFIG:Debug&gt;,$&lt;CONFIG:RelWithDebInfo&gt;&gt;:QT_QML_DEBUG&gt;)
  target_link_libraries(QtQuickCMakeTest
    PRIVATE Qt5::Core Qt5::Quick Qt5::QuickControls2 Qt5::QuickTemplates2)
  </code></pre>
  <p>The application is running, so I am not getting linking errors, but the QQmlApplicationEngine::objectCreated hooked returns my QObject as nullptr, causing QCoreApplication::exit(-1); to be called.</p>