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

target_link_libraries(foo INTERFACE Qt::Core) fails for interface libs with CMake < 3.19 on Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • None
    • 6.5.0 Beta3
    • Build System: CMake
    • None
    • Windows
    • bbfb9657f (dev), 58e615e00 (dev), 41de08dda (6.8), dd8b2fe8e (6.8), 5caab7e7e (6.7), f319c3826 (6.7), b0b79175d (tqtc/lts-6.5), 1f61ef841 (tqtc/lts-6.5), e48d1952f (dev), 2aed97fe2 (6.8), c7573b260 (tqtc/lts-6.5)

      See https://codereview.qt-project.org/c/qt/qtquickeffectmaker/+/454986/4/src/doc/CMakeLists.txt#2

      add_library(QtQuickEffectMakerDoc INTERFACE)
      target_link_libraries(QtQuickEffectMakerDoc INTERFACE Qt::Core)
      

      results in this error during the generation phase with CMake 3.16 on Windows:

      -- Configuring done
      CMake Error at qtquickeffectmaker/src/doc/CMakeLists.txt:1 (add_library):
        INTERFACE_LIBRARY targets may only have whitelisted properties.  The
        property "WIN32_EXECUTABLE" is not allowed.
      

      The culprit is this bit in the interface of QtCore:

          if(WIN32)
              list(APPEND entrypoint_conditions "$<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>")
          endif()
      

      even though it's wrappend in an AND condition that checks whether the target's type is EXECUTABLE...

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

            jbornema Joerg Bornemann
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: