Dax89 / QHexView

A versatile Hexadecimal widget for Qt5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

5.0 branch and Qt5 cmake compatibility

audetto opened this issue · comments

Hi,

I am trying to build the 5.0 branch with Qt5 and the line

find_package(Qt6 COMPONENTS Widgets)

fails in cmake with

CMake Warning at source/frontends/qt/QHexView/CMakeLists.txt:5 (find_package):
[cmake]   By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "Qt6", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "Qt6" with any of
[cmake]   the following names:
[cmake] 
[cmake]     Qt6Config.cmake
[cmake]     qt6-config.cmake

But if I remove all the lines

find_package(Qt6 COMPONENTS Widgets)
if(NOT Qt6_FOUND)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
endif()

then everything works correctly as it is my application to find Qt5. I think this is the case since the source files are in the INTERFACE section, so they are complied as part of my lib, not this lib (???)

It is the case that since this is not the "main" cmake file, it should leave it to something else to find the right Qt things?
Imagine I have both Qt5 and Qt6 and I want to use Qt5, this library will instead find Qt6 first?

uhmm, it is only a cmake warning, it still works.

but I still think that since QT is not used in this cmake file, it should not be requested.

Yeah it can be removed, so it uses the correct Qt version from the main project.

I will push a fix tomorrow.