Qt6+CMake. QNetworkAuth not detected.
-
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.
-
Hi,
I see you copied stuff manually ? What about calling "make install" in the build folder ?
-
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.
@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
configurecan get confused by its own output ... -
Hi,
I see you copied stuff manually ? What about calling "make install" in the build folder ?
@SGaist @kshegunov
I had time to do some experimentation, I found two things:- 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.
- I had the name of the package wrong in the CMakeLists.txt. According to the documentation it should be
-
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.txtfile.