stachenov / quazip

Qt/C++ wrapper over minizip
Other
582 stars 232 forks source link

Detection of Qt is flawed. #163

Closed allenck closed 8 months ago

allenck commented 1 year ago

I have two versions of Qt on my machine, both installed using the Qt Maintenance tool. I have not installed a standard Ubuntu 'package'. To do so would take up unnecessary space and possibly cause conflicts.

When I tried to build version 1.3, I got this error: `CMake Error at CMakeLists.txt:59 (find_package): By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5", but CMake did not find one.

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

Qt5Config.cmake
qt5-config.cmake

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

-- Configuring incomplete, errors occurred! ` I have been unable to locate any files like Qt5Config.cmake or qt5-config.cmake in my Qt installation. Obviously, these are files which exist in some 'package' but not in the Qt versions installed by Qt Maitenance Tool.

It seems to me that the proper way of building QaZip would be to provide a QtCreator .pro file or recognize the directory structure constructed by the Qt Maintenance Tool.

cen1 commented 1 year ago

I think something must be wrong with your install. I don't have Ubuntu Desktop with me right now but the path to the file should be Qt/5.15.2/<compiler>/lib/cmake/Qt5/Qt5Config.cmake.

I verified this on Mac OS, Windows 10 and Fedora using Qt Online Installer.

bugwelle commented 1 year ago

Seems as if no proper version can be found at all. You can set QUAZIP_QT_MAJOR_VERSION to 6 to enforce a specific version, see

https://github.com/stachenov/quazip/blob/f9aee420eac175ddc3f2a3f8bc6a227c3008bf7f/CMakeLists.txt#L32-L57

This is what I used for a custom Qt6 build:

export PATH="${HOME}/Projects/GitHub/qt6_dev/qt6-install:$PATH"

where qt6-install contains all bin/, lib/, etc folders of my Qt installation.

allenck commented 1 year ago

Thw Qt online installer is definitely not the same as the Qt Maintenance Tool! I use the Qt Maintenance tool because I don't want a version of QT installed to /usr/... whatever.

bugwelle commented 1 year ago

I use the Qt maintenance tool as well on Windows, macOS and Linux (Kubuntu). It installs Qt to $HOME/Qt per default, I think (or to C:\Qt on Windows). Add the correct Qt version to your $PATH (as in my example above) and try to run CMake again. As far as I know, QuaZip's CMakeLists.txt first tries to find Qt6, and if it does not find it, tries to load Qt5. If that is also not found, it fails with the error message you got. :-)

Chnossos commented 1 year ago

CMake detects a Qt installation by looking for qmake or qmake.exe in your PATH.

RichardTea commented 1 year ago

If you are not using the "system" Qt, then you must manually specify where the version of Qt you wish to use was installed.

Otherwise, how could your build system possibly know which version of Qt you want to use?

Qt Creator specifies this as part of the chosen "Kit", for both cmake (cmakelists.txt) and qmake (*.pro) builds.

When building using command-line tools, there are several different ways you can specify which version of Qt you wish to use:

Qt6 is similar.

cen1 commented 8 months ago

According to my research, CMAKE_PREFIX_PATH is the preferred way which should work for either version. Documented in readme.