[Pkg-cmake-team] Bug#1087385: cmake 3.31.0-1 breaks Qt6Qml builds
Brad King
brad.king at kitware.com
Wed Nov 13 20:23:14 GMT 2024
On Wed, Nov 13, 2024 at 11:38 AM Brad King wrote:
> > If parses fine with 3.30.5 and fails with 3.31.0.
> I can reproduce the problem locally. I'll track it down.
The change in behavior is due to CMake 3.31 fixing this bug:
* https://gitlab.kitware.com/cmake/cmake/-/issues/25728
Here is a simple example:
```
cmake_minimum_required(VERSION 3.30)
project(DebianIssue1087385 C)
add_library(iface INTERFACE IMPORTED)
set_property(TARGET iface PROPERTY INTERFACE_INCLUDE_DIRECTORIES
"/does/not/exist")
add_executable(main main.c)
target_link_libraries(main PRIVATE iface)
```
With both 3.30.5 and 3.31.0 the simple example correctly fails:
```
CMake Error in CMakeLists.txt:
Imported target "iface" includes non-existent path
"/does/not/exist"
in its INTERFACE_INCLUDE_DIRECTORIES.
```
However, if one adds the code:
```
target_include_directories(main PRIVATE
"$<TARGET_PROPERTY:iface,INTERFACE_INCLUDE_DIRECTORIES>")
```
then 3.30.5 incorrectly works due to the above-linked bug.
3.31.0 fixes that bug and now produces the correct diagnostic.
In Qt6Qml, `Qt6QmlMacros.cmake` adds that extra line in
the end of the `_qt_internal_qml_type_registration` function:
```
target_include_directories(${effective_target} PRIVATE
$<TARGET_PROPERTY:${QT_CMAKE_EXPORT_NAMESPACE}::QmlPrivate,INTERFACE_INCLUDE_DIRECTORIES>
)
```
-Brad
More information about the Pkg-cmake-team
mailing list