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

[cmake] private linking of static qt libs drop usage requirements

    XMLWordPrintable

Details

    • cca279338c5778fe09fa52384a1ffa5531885cf5 (qt/qtbase/5.14)

    Description

      i have the following library layout:

       

      add_library( lib lib.cpp )
      target_link_libraries( lib PRIVATE Qt5::Qml Qt5::Quick Qt5::Core )
      add_executable( app app.cpp )
      target_link_libraries( app lib )
      

      this causes cmake to link with the following command line:

       

       

      /Applications/Xcode10.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -Wdelete-non-virtual-dtor -Wdeprecated-writable-strings -Wmissing-braces -Wreturn-type -Wshorten-64-to-32 -Wsign-compare -Wunused-parameter -Wunused-private-field -Wunused-variable -Wno-logical-op-parentheses -Wno-overloaded-virtual -Wno-reorder -Wno-unused-function -fcolor-diagnostics -fpascal-strings -g -arch x86_64 -isysroot /Applications/Xcode10.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.13 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -dead_strip path/to/CMakeFiles/app.dir/app.cpp.o  -o path/to/app  path/to/liblib.a  path/to/qt/lib/libQt5Qml_debug.a  path/to/qt/lib/libQt5Quick_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_messages_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_local_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_server_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_debugger_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_inspector_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_native_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_nativedebugger_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_preview_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_profiler_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_quickprofiler_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_tcp_debug.a  path/to/qt/lib/libQt5QmlModels_debug.a  path/to/qt/lib/libQt5Qml_debug.a  path/to/qt/lib/libQt5Quick_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_messages_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_local_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_server_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_debugger_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_inspector_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_native_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_nativedebugger_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_preview_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_profiler_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_quickprofiler_debug.a  path/to/qt/plugins/qmltooling/libqmldbg_tcp_debug.a  path/to/qt/lib/libQt5QmlModels_debug.a  path/to/qt/lib/libQt5Gui_debug.a  path/to/qt/plugins/platforms/libqcocoa_debug.a  path/to/qt/plugins/imageformats/libqgif_debug.a  path/to/qt/plugins/imageformats/libqicns_debug.a  path/to/qt/plugins/imageformats/libqico_debug.a  path/to/qt/plugins/imageformats/libqjpeg_debug.a  path/to/qt/plugins/imageformats/libqmacheif_debug.a  path/to/qt/plugins/imageformats/libqmacjp2_debug.a  path/to/qt/plugins/imageformats/libqtga_debug.a  path/to/qt/plugins/imageformats/libqtiff_debug.a  path/to/qt/plugins/imageformats/libqwbmp_debug.a  path/to/qt/plugins/imageformats/libqwebp_debug.a  path/to/qt/lib/libQt5AccessibilitySupport_debug.a  path/to/qt/lib/libQt5ThemeSupport_debug.a  path/to/qt/lib/libQt5FontDatabaseSupport_debug.a  path/to/qt/lib/libQt5GraphicsSupport_debug.a  path/to/qt/lib/libQt5PrintSupport_debug.a  path/to/qt/lib/libQt5Widgets_debug.a  path/to/qt/lib/libQt5ClipboardSupport_debug.a  path/to/qt/plugins/printsupport/libcocoaprintersupport_debug.a  path/to/qt/plugins/styles/libqmacstyle_debug.a  path/to/qt/lib/libQt5Gui_debug.a  path/to/qt/plugins/platforms/libqcocoa_debug.a  path/to/qt/plugins/imageformats/libqgif_debug.a  path/to/qt/plugins/imageformats/libqicns_debug.a  path/to/qt/plugins/imageformats/libqico_debug.a  path/to/qt/plugins/imageformats/libqjpeg_debug.a  path/to/qt/plugins/imageformats/libqmacheif_debug.a  path/to/qt/plugins/imageformats/libqmacjp2_debug.a  path/to/qt/plugins/imageformats/libqtga_debug.a  path/to/qt/plugins/imageformats/libqtiff_debug.a  path/to/qt/plugins/imageformats/libqwbmp_debug.a  path/to/qt/plugins/imageformats/libqwebp_debug.a  path/to/qt/lib/libQt5AccessibilitySupport_debug.a  path/to/qt/lib/libQt5ThemeSupport_debug.a  path/to/qt/lib/libQt5FontDatabaseSupport_debug.a  path/to/qt/lib/libQt5GraphicsSupport_debug.a  path/to/qt/lib/libQt5PrintSupport_debug.a  path/to/qt/lib/libQt5Widgets_debug.a  path/to/qt/lib/libQt5ClipboardSupport_debug.a  path/to/qt/plugins/printsupport/libcocoaprintersupport_debug.a  path/to/qt/plugins/styles/libqmacstyle_debug.a  /usr/lib/libcups.dylib  path/to/qt/lib//libQt5AccessibilitySupport_debug.a  path/to/qt/lib//libQt5ThemeSupport_debug.a  path/to/qt/lib//libQt5FontDatabaseSupport_debug.a  path/to/qt/lib//libQt5GraphicsSupport_debug.a  path/to/qt/lib//libQt5ClipboardSupport_debug.a  /usr/local/lib/libjpeg.dylib  path/to/qt/lib//libQt5DBus_debug.a  /usr/local/lib/libfreetype.dylib  path/to/qt/lib//libQt5PrintSupport_debug.a  path/to/qt/lib//libQt5Widgets_debug.a  path/to/qt/lib/libQt5PacketProtocol_debug.a  path/to/qt/lib//libQt5Quick_debug.a  path/to/qt/lib//libQt5Gui_debug.a  /usr/local/lib/libpng.dylib  path/to/qt/lib//libqtharfbuzz_debug.a  path/to/qt/lib//libQt5QmlModels_debug.a  path/to/qt/lib//libQt5PacketProtocol_debug.a  path/to/qt/lib/libQt5Network_debug.a  path/to/qt/plugins/bearer/libqgenericbearer_debug.a  path/to/qt/lib/libQt5Network_debug.a  path/to/qt/plugins/bearer/libqgenericbearer_debug.a  path/to/qt/lib//libQt5Qml_debug.a  path/to/qt/lib//libQt5Network_debug.a  path/to/qt/lib//libQt5Core_debug.a  path/to/qt/lib/libQt5Core_debug.a  /usr/lib/libm.dylib  /usr/lib/libz.dylib  path/to/qt/lib//libqtpcre2_debug.a
      

      especially: this drops all usage requirements for qt libraries.

      if i link the qt libs `PUBLIC`ly instead of `PRIVATE`ly, the frameworks are correctly passed:

      /Applications/Xcode10.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++  -Wdelete-non-virtual-dtor -Wdeprecated-writable-strings -Wmissing-braces -Wreturn-type -Wshorten-64-to-32 -Wsign-compare -Wunused-parameter -Wunused-private-field -Wunused-variable -Wno-logical-op-parentheses -Wno-overloaded-virtual -Wno-reorder -Wno-unused-function -fcolor-diagnostics -fpascal-strings -g -arch x86_64 -isysroot /Applications/Xcode10.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.13 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -dead_strip    -framework SystemConfiguration -framework GSS -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework Security -framework CoreFoundation -framework CoreServices -framework SystemConfiguration -framework GSS -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework Metal -framework CoreGraphics -framework SystemConfiguration -framework GSS -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework Metal -framework CoreGraphics -framework OpenGL -framework AGL -framework SystemConfiguration -framework GSS -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework SystemConfiguration -framework GSS -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework Metal -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework AppKit -framework CoreGraphics -framework Foundation -framework OpenGL -framework AGL -framework ApplicationServices -framework Carbon -framework QuartzCore -framework CoreVideo -framework IOSurface -framework CoreText -framework ImageIO -framework Metal -framework CoreGraphics -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework Metal -framework CoreGraphics -framework OpenGL -framework AGL -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework Metal -framework CoreGraphics -framework OpenGL -framework AGL -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework Metal -framework CoreGraphics -framework OpenGL -framework AGL -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework AppKit -framework OpenGL -framework AGL -framework Metal -framework CoreGraphics -framework OpenGL -framework AGL -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework AppKit -framework OpenGL -framework AGL -framework Metal -framework CoreGraphics -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework AppKit -framework Metal -framework CoreGraphics -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL -framework ImageIO -framework Metal -framework CoreGraphics -framework OpenGL -framework AGL -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework AppKit -framework OpenGL -framework AGL -framework ImageIO -framework Metal -framework CoreGraphics -framework DiskArbitration -framework IOKit -framework AppKit -framework Security -framework ApplicationServices -framework CoreServices -framework CoreFoundation -framework Foundation -framework OpenGL -framework AGL path/to/CMakeFiles/app.dir/app.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Network/Qt5Network_QGenericEnginePlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QDebugMessageServiceFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QLocalClientConnectionFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlDebugServerFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlDebuggerServiceFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlInspectorServiceFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QCocoaIntegrationPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Widgets/Qt5Widgets_QMacStylePlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5PrintSupport/Qt5PrintSupport_QCocoaPrinterSupportPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QGifPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QICNSPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QICOPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QJpegPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QMacHeifPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QMacJp2Plugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QTgaPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QTiffPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QWbmpPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Gui/Qt5Gui_QWebpPlugin_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlNativeDebugConnectorFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlNativeDebugServiceFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlPreviewServiceFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQmlProfilerServiceFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QQuickProfilerAdapterFactory_Import.cpp.o path/to/CMakeFiles/app.dir/path/to/qt/lib/cmake/Qt5Qml/Qt5Qml_QTcpServerConnectionFactory_Import.cpp.o  -o path/to/app  path/to/liblib.a  /path/to/qt/lib/libQt5Qml_debug.a  /path/to/qt/lib/libQt5Quick_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_messages_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_local_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_server_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_debugger_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_inspector_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_native_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_nativedebugger_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_preview_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_profiler_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_quickprofiler_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_tcp_debug.a  /path/to/qt/lib/libQt5QmlModels_debug.a  /path/to/qt/lib/libQt5Qml_debug.a  /path/to/qt/lib/libQt5Quick_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_messages_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_local_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_server_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_debugger_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_inspector_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_native_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_nativedebugger_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_preview_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_profiler_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_quickprofiler_debug.a  /path/to/qt/plugins/qmltooling/libqmldbg_tcp_debug.a  /path/to/qt/lib/libQt5QmlModels_debug.a  /path/to/qt/lib/libQt5Gui_debug.a  /path/to/qt/plugins/platforms/libqcocoa_debug.a  /path/to/qt/plugins/imageformats/libqgif_debug.a  /path/to/qt/plugins/imageformats/libqicns_debug.a  /path/to/qt/plugins/imageformats/libqico_debug.a  /path/to/qt/plugins/imageformats/libqjpeg_debug.a  /path/to/qt/plugins/imageformats/libqmacheif_debug.a  /path/to/qt/plugins/imageformats/libqmacjp2_debug.a  /path/to/qt/plugins/imageformats/libqtga_debug.a  /path/to/qt/plugins/imageformats/libqtiff_debug.a  /path/to/qt/plugins/imageformats/libqwbmp_debug.a  /path/to/qt/plugins/imageformats/libqwebp_debug.a  /path/to/qt/lib/libQt5AccessibilitySupport_debug.a  /path/to/qt/lib/libQt5ThemeSupport_debug.a  /path/to/qt/lib/libQt5FontDatabaseSupport_debug.a  /path/to/qt/lib/libQt5GraphicsSupport_debug.a  /path/to/qt/lib/libQt5PrintSupport_debug.a  /path/to/qt/lib/libQt5Widgets_debug.a  /path/to/qt/lib/libQt5ClipboardSupport_debug.a  /path/to/qt/plugins/printsupport/libcocoaprintersupport_debug.a  /path/to/qt/plugins/styles/libqmacstyle_debug.a  /path/to/qt/lib/libQt5Gui_debug.a  /path/to/qt/plugins/platforms/libqcocoa_debug.a  /path/to/qt/plugins/imageformats/libqgif_debug.a  /path/to/qt/plugins/imageformats/libqicns_debug.a  /path/to/qt/plugins/imageformats/libqico_debug.a  /path/to/qt/plugins/imageformats/libqjpeg_debug.a  /path/to/qt/plugins/imageformats/libqmacheif_debug.a  /path/to/qt/plugins/imageformats/libqmacjp2_debug.a  /path/to/qt/plugins/imageformats/libqtga_debug.a  /path/to/qt/plugins/imageformats/libqtiff_debug.a  /path/to/qt/plugins/imageformats/libqwbmp_debug.a  /path/to/qt/plugins/imageformats/libqwebp_debug.a  /path/to/qt/lib/libQt5AccessibilitySupport_debug.a  /path/to/qt/lib/libQt5ThemeSupport_debug.a  /path/to/qt/lib/libQt5FontDatabaseSupport_debug.a  /path/to/qt/lib/libQt5GraphicsSupport_debug.a  /path/to/qt/lib/libQt5PrintSupport_debug.a  /path/to/qt/lib/libQt5Widgets_debug.a  /path/to/qt/lib/libQt5ClipboardSupport_debug.a  /path/to/qt/plugins/printsupport/libcocoaprintersupport_debug.a  /path/to/qt/plugins/styles/libqmacstyle_debug.a  /usr/lib/libcups.dylib  /path/to/qt/lib//libQt5AccessibilitySupport_debug.a  /path/to/qt/lib//libQt5ThemeSupport_debug.a  /path/to/qt/lib//libQt5FontDatabaseSupport_debug.a  /path/to/qt/lib//libQt5GraphicsSupport_debug.a  /path/to/qt/lib//libQt5ClipboardSupport_debug.a  /usr/local/lib/libjpeg.dylib  /path/to/qt/lib//libQt5DBus_debug.a  /usr/local/lib/libfreetype.dylib  /path/to/qt/lib//libQt5PrintSupport_debug.a  /path/to/qt/lib//libQt5Widgets_debug.a  /path/to/qt/lib/libQt5PacketProtocol_debug.a  /path/to/qt/lib//libQt5Quick_debug.a  /path/to/qt/lib//libQt5Gui_debug.a  /usr/local/lib/libpng.dylib  /path/to/qt/lib//libqtharfbuzz_debug.a  /path/to/qt/lib//libQt5QmlModels_debug.a  /path/to/qt/lib//libQt5PacketProtocol_debug.a  /path/to/qt/lib/libQt5Network_debug.a  /path/to/qt/plugins/bearer/libqgenericbearer_debug.a  /path/to/qt/lib/libQt5Network_debug.a  /path/to/qt/plugins/bearer/libqgenericbearer_debug.a  /path/to/qt/lib//libQt5Qml_debug.a  /path/to/qt/lib//libQt5Network_debug.a  /path/to/qt/lib//libQt5Core_debug.a  /path/to/qt/lib/libQt5Core_debug.a  /usr/lib/libm.dylib  /usr/lib/libz.dylib  /path/to/qt/lib//libqtpcre2_debug.a
      

      all frameworks and all plugin import files are passed correctly now

       

      Attachments

        1. qtbug-80855.tar.gz
          3 kB
          Joerg Bornemann

        Issue Links

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

          Activity

            People

              jbornema Joerg Bornemann
              timblechmann tim blechmann
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes