Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
6.2.0
-
None
Description
I try to use Qt6 with CMake, but I have to manually give paths to each Component "Tools"
My minimal repro is the following CMake
cmake_minimum_required(VERSION 3.19)
project(couldNotFindTools)
find_package(Qt6 COMPONENTS Core REQUIRED)
When executing cmake (3.19.1) I get the following:
E:\work\couldNotFindTools\build>cmake -D Qt6_DIR="e:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6" ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30037.0
-- The CXX compiler identification is MSVC 19.29.30037.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30037/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Check if linker can resolve circular dependencies - TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Could NOT find Qt6CoreTools (missing: Qt6CoreTools_DIR)
CMake Warning at E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake:176 (find_package):
{{ Found package configuration file:}}
E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake
but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be
NOT FOUND.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
CMake Error at CMakeLists.txt:3 (find_package):
Found package configuration file:
e:/Qt/6.2.0/msvc2019_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 "Core".
Expected Config file at
"E:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake" exists
-- Configuring incomplete, errors occurred!
See also "E:/work/couldNotFindTools/build/CMakeFiles/CMakeOutput.log".
See also "E:/work/couldNotFindTools/build/CMakeFiles/CMakeError.log".
It runs as expected if I add -D Qt6CoreTools_DIR="e:/Qt/6.2.0/msvc2019_64/lib/cmake/Qt6CoreTools"
Attachments
Issue Links
- relates to
-
QTBUG-83772 `find_package(Qt6Core)` is broken - dependency finders should be `include`d directly
-
- Reported
-
-
QTBUG-102730 CMake: find_package does not set QT_DEFAULT_MAJOR_VERSION
-
- Reported
-
-
QTBUG-115437 Setting Qt6_DIR is not enough to find Qt packages
-
- Closed
-
-
QTBUG-123914 Cannot find Qt6QmlTools_DIR automatically
-
- Closed
-
-
QTBUG-104998 Improve find_package(Qt6) diagnostics
-
- Closed
-
-
QTBUG-105089 Warn if user passes lib/cmake/Qt6 in CMAKE_PREFIX_PATH
-
- Closed
-
- resulted in
-
QTBUG-115437 Setting Qt6_DIR is not enough to find Qt packages
-
- Closed
-
- mentioned in
-
Page Loading...
For Gerrit Dashboard: QTBUG-97615 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
421441,9 | CMake: Allow setting Qt6_DIR to find packages when not cross-compiling | dev | qt/qtbase | Status: MERGED | +2 | 0 |
422364,3 | CMake: Allow setting Qt6_DIR to find packages when not cross-compiling | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |