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

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0 Beta3
    • Build System: CMake
    • None
    • Windows

    Description

      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...

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-111760
          # Subject Branch Project Status CR V

          Activity

            People

              mrmsdbdl Amir Masoud Abdol
              jbornema Joerg Bornemann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There is 1 open Gerrit change