Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Qt6+CMake. QNetworkAuth not detected.
QtWS25 Last Chance

Qt6+CMake. QNetworkAuth not detected.

Scheduled Pinned Locked Moved Unsolved Qt 6
5 Posts 3 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    artwaw
    wrote on 11 Dec 2020, 10:31 last edited by artwaw 12 Nov 2020, 11:01
    #1

    Good morning,
    I tried to give the above a test run. For starters - I am not very experienced with CMake, might be I did something silly.

    My configuration is the above, installed via online installer. MacOS BigSur.

    I did play a bit with different test programs to get the feeling of config files etc., then decided to compile, as advised, QNetworkAuth module:

    • loaded root of the source to Qt Creator
    • compiled in release mode
      All went surprisingly smooth, no errors, warnings. Green across the board, so to speak.

    So then I copied the result .framework and other files to their respective places... But CMake can't see the files.

    My CMakeLists.txt file:

    make_minimum_required(VERSION 3.5)
    
    project(oat LANGUAGES CXX)
    
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    set(QT_DEFAULT_MAJOR_VERSION 6)
    
    # QtCreator supports the following variables for Android, which are identical to qmake Android variables.
    # Check http://doc.qt.io/qt-5/deployment-android.html for more information.
    # They need to be set before the find_package(Qt5 ...) call.
    
    #if(ANDROID)
    #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
    #    if (ANDROID_ABI STREQUAL "armeabi-v7a")
    #        set(ANDROID_EXTRA_LIBS
    #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
    #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
    #    endif()
    #endif()
    
    find_package(QT NAMES Qt6 COMPONENTS Core Widgets LinguistTools Network Gui NetworkAuth REQUIRED)
    find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools Network Gui NetworkAuth REQUIRED)
    
    set(TS_FILES oat_en_GB.ts)
    
    add_executable(oat
        main.cpp
        oat.cpp
        gsuitewrapper.cpp
        gsuitewrapper.h
        oat.h
        oat.ui
        ${TS_FILES}
    )
    
    target_link_libraries(oat PRIVATE Qt6::Core Qt6::Widgets Qt6::Network Qt6::Gui Qt6::NetworkAuth)
    
    #qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
    

    Please note that last line is commented out, CMake fails on that step - I understand that it's a bug of some sorts and it will go away at some point. Not an issue atm.

    Error I get:

    -- Could NOT find Qt6NetworkAuth (missing: Qt6NetworkAuth_DIR)
    CMake Error at CMakeLists.txt:30 (find_package):
      Found package configuration file:
    
        /Users/(...)/Qt/6.0.0/clang_64/lib/cmake/Qt6/Qt6Config.cmake
    
      but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
      FOUND.  Reason given by package:
    
      Failed to find Qt component "NetworkAuth" config file at ""
    
      
    
    
    
    -- Configuring incomplete, errors occurred!
    See also "/Users/(...)/cpp/build-oat-Desktop_Qt_6_0_0_clang_64bit-Debug/CMakeFiles/CMakeOutput.log".
    CMake process exited with exit code 1.
    

    Any advice you can offer?
    Thanks in advance.

    EDIT: I build QNetworkAuth with qmake and included in the test project - works flawlessly.

    For more information please re-read.

    Kind Regards,
    Artur

    K 1 Reply Last reply 11 Dec 2020, 19:21
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 Dec 2020, 19:16 last edited by
      #2

      Hi,

      I see you copied stuff manually ? What about calling "make install" in the build folder ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply 14 Dec 2020, 16:10
      1
      • A artwaw
        11 Dec 2020, 10:31

        Good morning,
        I tried to give the above a test run. For starters - I am not very experienced with CMake, might be I did something silly.

        My configuration is the above, installed via online installer. MacOS BigSur.

        I did play a bit with different test programs to get the feeling of config files etc., then decided to compile, as advised, QNetworkAuth module:

        • loaded root of the source to Qt Creator
        • compiled in release mode
          All went surprisingly smooth, no errors, warnings. Green across the board, so to speak.

        So then I copied the result .framework and other files to their respective places... But CMake can't see the files.

        My CMakeLists.txt file:

        make_minimum_required(VERSION 3.5)
        
        project(oat LANGUAGES CXX)
        
        set(CMAKE_INCLUDE_CURRENT_DIR ON)
        
        set(CMAKE_AUTOUIC ON)
        set(CMAKE_AUTOMOC ON)
        set(CMAKE_AUTORCC ON)
        
        set(CMAKE_CXX_STANDARD 17)
        set(CMAKE_CXX_STANDARD_REQUIRED ON)
        
        set(QT_DEFAULT_MAJOR_VERSION 6)
        
        # QtCreator supports the following variables for Android, which are identical to qmake Android variables.
        # Check http://doc.qt.io/qt-5/deployment-android.html for more information.
        # They need to be set before the find_package(Qt5 ...) call.
        
        #if(ANDROID)
        #    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
        #    if (ANDROID_ABI STREQUAL "armeabi-v7a")
        #        set(ANDROID_EXTRA_LIBS
        #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
        #            ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
        #    endif()
        #endif()
        
        find_package(QT NAMES Qt6 COMPONENTS Core Widgets LinguistTools Network Gui NetworkAuth REQUIRED)
        find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools Network Gui NetworkAuth REQUIRED)
        
        set(TS_FILES oat_en_GB.ts)
        
        add_executable(oat
            main.cpp
            oat.cpp
            gsuitewrapper.cpp
            gsuitewrapper.h
            oat.h
            oat.ui
            ${TS_FILES}
        )
        
        target_link_libraries(oat PRIVATE Qt6::Core Qt6::Widgets Qt6::Network Qt6::Gui Qt6::NetworkAuth)
        
        #qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
        

        Please note that last line is commented out, CMake fails on that step - I understand that it's a bug of some sorts and it will go away at some point. Not an issue atm.

        Error I get:

        -- Could NOT find Qt6NetworkAuth (missing: Qt6NetworkAuth_DIR)
        CMake Error at CMakeLists.txt:30 (find_package):
          Found package configuration file:
        
            /Users/(...)/Qt/6.0.0/clang_64/lib/cmake/Qt6/Qt6Config.cmake
        
          but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
          FOUND.  Reason given by package:
        
          Failed to find Qt component "NetworkAuth" config file at ""
        
          
        
        
        
        -- Configuring incomplete, errors occurred!
        See also "/Users/(...)/cpp/build-oat-Desktop_Qt_6_0_0_clang_64bit-Debug/CMakeFiles/CMakeOutput.log".
        CMake process exited with exit code 1.
        

        Any advice you can offer?
        Thanks in advance.

        EDIT: I build QNetworkAuth with qmake and included in the test project - works flawlessly.

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 11 Dec 2020, 19:21 last edited by
        #3

        @artwaw said in Qt6+CMake. QNetworkAuth not detected.:

        Error I get:
        [snip]

        That's similar to what I got the other day when I tried building, but I got it for something xcb/xinput thing related. I haven't had the time to sift through it all, but I can confidently say that even configure can get confused by its own output ...

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        1
        • S SGaist
          11 Dec 2020, 19:16

          Hi,

          I see you copied stuff manually ? What about calling "make install" in the build folder ?

          A Offline
          A Offline
          artwaw
          wrote on 14 Dec 2020, 16:10 last edited by
          #4

          @SGaist @kshegunov
          I had time to do some experimentation, I found two things:

          1. I had the name of the package wrong in the CMakeLists.txt. According to the documentation it should be Networkauth, NOT NetworkAuth.

          But, however interesting, it solved nothing because error stays the same:

          -- Could NOT find Qt6Networkauth (missing: Qt6Networkauth_DIR)
          

          So I checked and indeed, there is missing folder Qt6Networkauth in Qt/6.0.0/clang_64/lib/cmake.
          This folder is not created at any time doing build process.

          @SGaist - I also tried to call make install, it copies the files to respective folders and nothing else.

          Now - does any of you gentleman can offer a hint as to what goes wrong so that folder is not created?

          Also - does using c++ 17 with qmake makes sense? I found release doc inconclusive in that regard.

          For more information please re-read.

          Kind Regards,
          Artur

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 14 Dec 2020, 16:24 last edited by
            #5

            Looks like you may have an issue with your module build. I do not have Big Sure yet but I just tested on Catalina with a build of the latest dev checkout of the module and except an issue with the install folder quickly fixed I was able to build a small project based on your CMakeLists.txt file.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            3/5

            11 Dec 2020, 19:21

            • Login

            • Login or register to search.
            3 out of 5
            • First post
              3/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved