title: CMake - Could not find a package configuration file provided by "QT"
body: <p>I've got some problems with CMake. It shows me an error when I try to configure my build for Visual Studio 2019. Everything looks fine to me when I check the CMakeLists.txt, but something is still wrong. The file was auto created by Qt, I just added some things to connect some directories. What can I do to solve this problem?</p>
  <p>Here is the error:</p>
  <pre><code>Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
  The CXX compiler identification is MSVC 19.28.29334.0
  Detecting CXX compiler ABI info
  Detecting CXX compiler ABI info - done
  Check for working CXX compiler: D:/VS/VS-IDE/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
  Detecting CXX compile features
  Detecting CXX compile features - done
  CMake Error at CMakeLists.txt:27 (find_package):
    Could not find a package configuration file provided by &quot;QT&quot; with any of
    the following names:
  
      Qt6Config.cmake
      qt6-config.cmake
      Qt5Config.cmake
      qt5-config.cmake
  
    Add the installation prefix of &quot;QT&quot; to CMAKE_PREFIX_PATH or set &quot;QT_DIR&quot; to
    a directory containing one of the above files.  If &quot;QT&quot; provides a separate
    development package or SDK, be sure it has been installed.
  
  
  Configuring incomplete, errors occurred!
  </code></pre>
  <p>Here is my CMakeList.txt:</p>
  <pre><code>cmake_minimum_required(VERSION 3.5)
  
  project(bacteria 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(QT NAMES Qt6 Qt5 COMPONENTS Widgets LinguistTools REQUIRED)
  find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets LinguistTools REQUIRED)
  
  #Mine add
  find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
  find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
  
  set(TS_FILES bacteria_ru_RU.ts)
  
  #Mine add
  set(CMAKE_PREFIX_PATH &quot;D:/Qt/5.15.2/mingw81_64&quot;)
  
  if(ANDROID)
    add_library(bacteria SHARED
      main.cpp
      mainwindow.cpp
      mainwindow.h
      mainwindow.ui
      #My add
      mainmatrix.cpp
      mainmatrix.h
      microbe.cpp
      microbe.h
      microbecontainer.cpp
      microbecontainer.h
      food.cpp
      food.h
      ${TS_FILES}
    )
  else()
    add_executable(bacteria
      main.cpp
      mainwindow.cpp
      mainwindow.h
      mainwindow.ui
      #My add
      mainmatrix.cpp
      mainmatrix.h
      microbe.cpp
      microbe.h
      microbecontainer.cpp
      microbecontainer.h
      food.cpp
      food.h
      ${TS_FILES}
    )
  endif()
  
  target_link_libraries(bacteria PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
  
  qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
  </code></pre>