-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5
-
None
-
-
28c9625d0 (dev), 8bdde990d (6.5), 87fc863c2 (6.6)
INTERFACE_LINK_OPTIONS from PlatformCommonInternal target is propagated by Qt6::EntryPointImplementation target to user projects, but it shouldn't. This happens only if the cmake policy CMP0099 is set to NEW. This sounds like upstream CMake issue, at least it's not expected from Qt code, that CMake disregards $<LINK_ONLY:...> genex when policy is set to NEW.
The following code snippet exposes the faulty behavior in CMake versions >=3.17:
cmake_minimum_required(VERSION 3.16...3.21) #cmake_policy(SET CMP0099 OLD) cmake_policy(SET CMP0099 NEW) project(mytest LANGUAGES CXX) add_library(PlatformCommonInternal INTERFACE) set_target_properties(PlatformCommonInternal PROPERTIES INTERFACE_LINK_OPTIONS "-NXCOMPAT" ) add_library(EntryPointPrivate STATIC lib.cpp) set_target_properties(EntryPointPrivate PROPERTIES INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:PlatformCommonInternal>" ) add_executable(mytest main.cpp) target_link_libraries(mytest PRIVATE EntryPointPrivate )
Upstream issue https://gitlab.kitware.com/cmake/cmake/-/issues/24920