Why does ${Qt6Core_INCLUDE_DIRS} contain Qt6::ZlibPrivate?
-
Hello,
I have an understanding problem with this variable, basically the following CMake minimal example configuration fails:
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) include(CheckIncludeFileCXX) project(CMake LANGUAGES CXX) find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui) set(CMAKE_REQUIRED_INCLUDES ${Qt6Core_INCLUDE_DIRS}) check_include_file_cxx(QtGui/qtgui-config.h HAVE_QTGUI_CONFIG_H)I call CMake like this:
"C:\Program Files\CMake\bin\cmake.exe" --debug-trycompile -S "./src" -G "Visual Studio 17 2022" -DQt6_DIR="C:/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6" -DQt6GuiTools_DIR="C:/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6GuiTools" -B "./bld"I get this error:
Looking for C++ include QtGui/qtgui-config.h CMake Debug Log at C:/Program Files/CMake/share/cmake-3.28/Modules/CheckIncludeFileCXX.cmake:89 (try_compile): Executing try_compile (HAVE_QTGUI_CONFIG_H) in: C:/prog/cpp/CMake/bld/CMakeFiles/CMakeScratch/TryCompile-ykkc7b Call Stack (most recent call first): CMakeLists.txt:7 (check_include_file_cxx) CMake Error at C:/prog/cpp/CMake/bld/CMakeFiles/CMakeScratch/TryCompile-ykkc7b/CMakeLists.txt:14 (include_directories): Error evaluating generator expression: $<TARGET_PROPERTY:Qt6::ZlibPrivate,_qt_module_has_private_headers> Target "Qt6::ZlibPrivate" not found.I have debugged it and can confidently say that it comes from the variable mentioned in the title.
I am confused about this, is this an CMake issue? Or Qt? Or am I using it wrong? Is this a bug?
Any help appreciated. -
Hello,
I have an understanding problem with this variable, basically the following CMake minimal example configuration fails:
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR) include(CheckIncludeFileCXX) project(CMake LANGUAGES CXX) find_package(Qt6 REQUIRED COMPONENTS Core Widgets Gui) set(CMAKE_REQUIRED_INCLUDES ${Qt6Core_INCLUDE_DIRS}) check_include_file_cxx(QtGui/qtgui-config.h HAVE_QTGUI_CONFIG_H)I call CMake like this:
"C:\Program Files\CMake\bin\cmake.exe" --debug-trycompile -S "./src" -G "Visual Studio 17 2022" -DQt6_DIR="C:/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6" -DQt6GuiTools_DIR="C:/Qt/6.6.0/msvc2019_64/lib/cmake/Qt6GuiTools" -B "./bld"I get this error:
Looking for C++ include QtGui/qtgui-config.h CMake Debug Log at C:/Program Files/CMake/share/cmake-3.28/Modules/CheckIncludeFileCXX.cmake:89 (try_compile): Executing try_compile (HAVE_QTGUI_CONFIG_H) in: C:/prog/cpp/CMake/bld/CMakeFiles/CMakeScratch/TryCompile-ykkc7b Call Stack (most recent call first): CMakeLists.txt:7 (check_include_file_cxx) CMake Error at C:/prog/cpp/CMake/bld/CMakeFiles/CMakeScratch/TryCompile-ykkc7b/CMakeLists.txt:14 (include_directories): Error evaluating generator expression: $<TARGET_PROPERTY:Qt6::ZlibPrivate,_qt_module_has_private_headers> Target "Qt6::ZlibPrivate" not found.I have debugged it and can confidently say that it comes from the variable mentioned in the title.
I am confused about this, is this an CMake issue? Or Qt? Or am I using it wrong? Is this a bug?
Any help appreciated.@Gertio said in Why does ${Qt6Core_INCLUDE_DIRS} contain Qt6::ZlibPrivate?:
the following CMake minimal example configuration fails:
Where did this come from? What are you trying to build?
Why does ${Qt6Core_INCLUDE_DIRS} contain Qt6::ZlibPrivate?
Qt6, by default, is built with a private copy of Zlib and some other libraries.