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

Qt6 CMake target compile options propagation (CUDA)

    XMLWordPrintable

    Details

    • Platform/s:
      Windows
    • Commits:
      ae294a42f0 (qt/qtbase/dev) 9794fc4e54 (qt/qtbase/6.3) c679193fde (qt/qtbase/6.2) c679193fde (qt/tqtc-qtbase/6.2)

      Description

      File: Qt6Targets.cmake

      
      set_target_properties(Qt6::Platform PROPERTIES
        INTERFACE_COMPILE_DEFINITIONS "WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;_WIN64;\$<\$<NOT:\$<BOOL:\$<TARGET_PROPERTY:QT_NO_UNICODE_DEFINES>>>:UNICODE;_UNICODE>"
        INTERFACE_COMPILE_FEATURES "cxx_std_17"
        INTERFACE_COMPILE_OPTIONS "-Zc:__cplusplus;-permissive-;\$<\$<NOT:\$<BOOL:\$<TARGET_PROPERTY:QT_NO_UTF8_SOURCE>>>:-utf-8>"
        INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/mkspecs/win32-msvc;${_IMPORT_PREFIX}/include"
        INTERFACE_LINK_LIBRARIES "Threads::Threads"
      )
      

      When linking Qt::Core with a library containing CUDA source files, the following flags are incorrectly propagated to nvcc "as-is" thus resulting in nvcc errors such as "unrecognized compile option":

      -Zc:__cplusplus
      -permissive-
      -utf-8
      

      I wonder if we should instead be doing:

      INTERFACE_COMPILE_OPTIONS "\$<\$<COMPILE_LANGUAGE:CXX>:-Zc:__cplusplus;-permissive-;\$<\$<NOT:\$<BOOL:\$<TARGET_PROPERTY:QT_NO_UTF8_SOURCE>>>:-utf-8>>"
      

      UPDATE: The above seems to fix the issue.

        Attachments

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

          Activity

            People

            Assignee:
            jbornema Joerg Bornemann
            Reporter:
            nickdademo Nick D'Ademo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes