Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-113641

PlatformCommonInternal INTERFACE_LINK_OPTIONS property is propagated to user projects

XMLWordPrintable

    • Windows
    • 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

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            semlanik Alexey Edelev
            semlanik Alexey Edelev
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes