[solved]CMake cannot find QT5



  • Hi

    I whant to build OSG with QT5.
    With qt4 it works fine but with QT5 I get the following message from CMake

    CMake Warning at C:/Program Files (x86)/CMake/share/cmake-3.0/Modules/FindQt4.cmake:616 (message):
    c:/Qt/Qt5.3.0/5.3/msvc2013_opengl/bin/qmake.exe reported QT_INSTALL_LIBS as
    "C:/Qt/Qt5.3.0/5.3/msvc2013_opengl/lib" but QtCore could not be found
    there. Qt is NOT installed correctly for the target build environment.

    Please advise


  • Lifetime Qt Champion

    Hi,

    Can you show the Qt 5 part of your CMakeList.txt ? Also, do you have e.g. Qt5CoreConfig.cmake in your installation somewhere ?



  • Hi

    There is not Qt5CoreConfig.cmake file in my installation somewhere.

    This is the part where tryed to find qt

    Include macro utilities here

    @INCLUDE(OsgMacroUtils)

    OPTION(OSG_USE_QT "Enable to use Qt (build Qt-dependent libraries, plugins and examples)" ON)

    IF(OSG_USE_QT AND NOT ANDROID)

    To select a specific version of QT define DESIRED_QT_VERSION

    via cmake -DDESIRED_QT_VERSION=5

    QUIET option disables messages if the package cannot be found.

    IF  (DESIRED_QT_VERSION)
        IF  (DESIRED_QT_VERSION MATCHES 5)
              FIND_PACKAGE(Qt5Widgets)
        ELSEIF (DESIRED_QT_VERSION MATCHES 4)
              FIND_PACKAGE(Qt4)
        ELSE()
              FIND_PACKAGE(Qt3)
        ENDIF()
    
    ELSE()
    
        FIND_PACKAGE(Qt5Widgets QUIET)
    
        IF ( Qt5Widgets_FOUND )
            # CMake 2.8.8 or greater required
            BUILDER_VERSION_GREATER(2 8 7)
            IF(NOT VALID_BUILDER_VERSION)
                MESSAGE(
                SEND_ERROR
                "Qt5 requires CMake version 2.8.8 or greater!\n"
                "Update CMake or set DESIRED_QT_VERSION to less than 5
                or disable OSG_USE_QT."
                )
            ENDIF( )
        ENDIF( )
    
        IF ( NOT Qt5Widgets_FOUND )
            FIND_PACKAGE(Qt4)
    
            IF (NOT QT4_FOUND)
                FIND_PACKAGE(Qt3)
            ENDIF()
        ENDIF()
    ENDIF()
    
    #If we have found Qt5, let's try to top off by getting the webkit as well
    IF ( Qt5Widgets_FOUND )
        FIND_PACKAGE(Qt5WebKitWidgets QUIET)
    ENDIF()
    

    ENDIF()@


  • Lifetime Qt Champion

    Do you have any cmake related file in your Qt installation ?



  • What do you mean exactly ?
    Before I built other project with Qt4. That's all


  • Lifetime Qt Champion

    I meant:

    check if C:/Qt/Qt5.3.0/5.3/msvc2013_opengl/ contains anything cmake related



  • I have solved the problem writing this

    @set(CMAKE_PREFIX_PATH "C:\Qt\Qt5.3.0\5.3\msvc2013_opengl" CACHE PATH "")
    set(CMAKE_LIBRARY_PATH "C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86")
    set(Qt5Widgets_DIR "c:\Qt\Qt5.3.0\5.3\msvc2013_opengl\lib\cmake\Qt5Widgets\")@

    Thanks


  • Lifetime Qt Champion

    You're welcome !

    Since you have it finding Qt 5 now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.