CMake find_package problem
Solved
Qt Creator and other tools
-
I'm trying a build a third party project which uses CMake on Windows using a Visual Studio command prompt.
But when I did so I got this:
D:\Github\SmtpClient-for-Qt>cmake -B ./build -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_PREFIX_PATH:STRING="C:\Qt\6.8.2\msvc2022_64" CMake Error at CMakeLists.txt:16 (find_package): Could not find a configuration file for package "Qt" that is compatible with requested version "". The following configuration files were considered but not accepted: C:/Qt/6.8.2/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.8.2 (64bit) -- Configuring incomplete, errors occurred!
lines 16 and 17 of the CMakeLists file read:
find_package(Qt NAMES Qt6 COMPONENTS Core Network REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network REQUIRED)
What is wrong please?
-
You are using the wrong Visual Studio command prompt. Very likely the
x86
version, and not thex86_64
one.This part:
The following configuration files were considered but not accepted: C:/Qt/6.8.2/msvc2022_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.8.2 (64bit)
gave it away.
-
P Perdrix has marked this topic as solved