qxmpp-project / qxmpp

Cross-platform C++ XMPP client and server library
400 stars 198 forks source link

Failed to execute cmake #611

Open H-hzh opened 3 months ago

H-hzh commented 3 months ago

Hi, this is my first time using qxmpp, but I am having problems as follows

-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.22631.
CMake Error at CMakeLists.txt:22 (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:

    D:/qt6.0/6.2.4/mingw_64/lib/cmake/Qt6/Qt6Config.cmake, version: 6.2.4 (64bit)

-- Configuring incomplete, errors occurred!

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Network Xml)//22 As I said, this is my first time to use it, and it's a little bad, so please explain it to me

lnjX commented 3 months ago

Not sure whats the problem here.

Does it make any difference if you try to replace the line with:

find_package(Qt 6 REQUIRED COMPONENTS Core Network Xml)
H-hzh commented 3 months ago

After the change is

CMake Warning (dev) at CMakeLists.txt:23 (find_package):
  Policy CMP0084 is not set: The FindQt module does not exist for
  find_package().  Run "cmake --help-policy CMP0084" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindQt.cmake:87 (message):
  FindQt was called with invalid version '6'.  Only Qt major versions 3 or 4
  are supported.  If you do not need to support both Qt3 and Qt4 in your
  source consider calling find_package(Qt3) or find_package(Qt4) instead of
  find_package(Qt) instead.
Call Stack (most recent call first):
  CMakeLists.txt:23 (find_package)

-- Configuring incomplete, errors occurred!
lnjX commented 3 months ago

Sorry! My mistake, I actually wanted to write:

find_package(Qt6 6.0 REQUIRED COMPONENTS Core Network Xml)
H-hzh commented 3 months ago

Sorry, it is still the same error, is it that I did not configure this path properly D:/qt6.0/6.2.4/mingw_64/lib/cmake/Qt6/Qt6Config.cmake How to configure this, please

lnjX commented 3 months ago

You can set the path using cmake with -DQt6_DIR=D:/qt6.0/6.2.4/mingw_64/lib/cmake/Qt6/, but it seems like cmake has already found that directory, I'm not sure what's the error here.