Cannot find Qt6 installation?
Asked Answered
R

3

8

Trying to follow the install instructions from a GitHub page: https://github.com/TASEmulators/fceux

I went through with installing Qt6 and when I do the following this happens:

mkdir build
cd build
cmake  -DCMAKE_INSTALL_PREFIX=/usr  -DQT6=1  -DCMAKE_BUILD_TYPE=Debug    ..

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- GUI Frontend: Qt6
CMake Error at src/CMakeLists.txt:22 (find_package):
  By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6" with any of
  the following names:

    Qt6Config.cmake
    qt6-config.cmake

  Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
  to a directory containing one of the above files.  If "Qt6" provides a
  separate development package or SDK, be sure it has been installed.


-- Configuring incomplete, errors occurred!

Ruthful answered 11/2, 2022 at 19:10 Comment(1)
"I went through with installing Qt6" - How/Where have you installed QT6? Does that installation has the files noted in the error message (Qt6Config.cmake or qt6-config.cmake)?Manamanacle
S
4

You can try to define the directory contains the installation of Qt6. Suppose Qt is installed in /home/user/Qt6

cmake -DCMAKE_PREFIX_PATH="/home/user/Qt6/6.4.2/gcc_64/lib/cmake" .
Supersensible answered 22/2, 2023 at 4:41 Comment(0)
C
1

As the error message says, you need up set the environment value Qt6_DIR to the location you installed qt6 to. This should be a part of the instructions in installing qt6.

You should link the instructions you used for installing qt6. They may contain instructions to set the environment variable QT_DIR instead of the Qt6_DIR which is required by what you're building. If this is the case just follow the instructions for setting QT_DIR to also set Qt6_DIR.

Clunk answered 11/2, 2022 at 19:26 Comment(4)
Sorry I have no idea if Qt6 actually installed correctly. I don't see any reference to a "Qt6Config.cmake" in the installation folder and when I look at the installation log it says stuff like [1572] Warning: No QtAccount credentials found. Please login via the maintenance tool of the SDK. [1572] Warning: No QtAccount credentials found. Please login via the maintenance tool of the SDK.Ruthful
Create a qt user on their website and try to install it again I suppose. The usual resulting installation folder is in the C: drive.Clunk
Qt6_DIR is not an environment variable, it is a cache variable, and it should not point to the Qt installation root, but to the directory specifically containing one of the mentioned "config.cmake" files.Laurelaureano
So if its not an environment variable where does it go?!Orthodontia
C
0

try adding this to the top of CMakeLists.txt

set(Qt6_DIR F:/Qt6.7/6.7.2/mingw_64/lib/cmake/Qt6/)

Replace the value with your path. Qt6Config.cmake or qt6-config.cmake be under the path.

Chord answered 4/8 at 7:54 Comment(2)
or add Qt CMake prefix path with F:\Qt6.7\6.7.2\mingw_64(replace with yours) when create Qt project by CLion.Chord
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Rollin

© 2022 - 2024 — McMap. All rights reserved.