[CMake] CMake 3.7.1 gui fails to launch

Andreas Pakulat apaku at gmx.de
Fri Jan 6 14:10:11 EST 2017


Hi,

On Fri, Jan 6, 2017 at 6:41 PM,  <daryl at daryllee.com> wrote:
> As it turns out, no, I can't use Qt5.  In fact, I'd love to hear from anyone
> who actually has.  I find this in Modules/FindQt.make:

That module is specifically only for applications wanting to support
Qt3 and Qt4 at the same time.

> ===========================
> if (Qt_FIND_VERSION)
>   if (Qt_FIND_VERSION MATCHES "^([34])(\\.[0-9]+.*)?$")
>     set(DESIRED_QT_VERSION ${CMAKE_MATCH_1})
>   else ()
>     message(FATAL_ERROR "FindQt was called with invalid version
> '${Qt_FIND_VERSION}'. 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.")
>   endif ()
> endif ()
> ===========================
>
> So I re-installed Qt4, rebuilt CMake (./bootstrap --qt-gui, make, sudo make
> install) and still got the same runtime failure.

Well, Qt5 isn't found through a find-module but rather through the
module-mode (or whatever it was called). Qt5 ships with cmake-specific
files that allow cmake to find it as long as its installed in a common
prefix (like /usr) or the installation directory is specified via
CMAKE_PREFIX_PATH. I suspect if you look at the CMakeLists.txt file
you'll see some logic to lookup Qt5 with something like
find_package(Qt5 MODULES QtCore QtGui QtWidgets) and a fallback for
finding with FindQt4 like find_package(Qt4 MODULES QtCore QtGui
QtWidgets). I don't think you'll find usage of the FindQt module in
the cmake sources as the code likely won't build with Qt3.

Andreas


More information about the CMake mailing list