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

CMake error when using qt5_use_modules() macro on object library

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.0.0, 5.0.1, 5.0.2
    • Build System
    • None
    • Unix / Windows

    Description

      CMake introduced new library type from version 2.8.8. Object libraries can be used for convenience in some case. Please see http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library and http://www.cmake.org/pipermail/cmake-developers/2012-March/003693.html for more information.

      The Qt5 macro 'tym_qt5_use_modules()' makes it easier to establish dependency between an executable/library and Qt libraries it depends on. Unfortunately, 'tym_qt5_use_modules()' can't be used on an object library.

      The problem is located in the file https://qt.gitorious.org/qt/qtbase/blobs/stable/src/corelib/Qt5CoreMacros.cmake#line243 (line 243). 'target_link_libraries()' can't be used with a CMake object library.

      A simple workaround is to test type of target before using 'target_link_libraries()'. If you replace line 243 by:

      get_target_property(_trgt_type ${_target} TYPE)
      if(NOT ${_trgt_type} STREQUAL "OBJECT_LIBRARY")
      target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES})
      endif()

      everything works fine and we can use 'qt5_use_modules()' on object libraries.

      Cheers

      Attachments

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

        Activity

          People

            stephen.kelly Stephen Kelly (Unused account) (Inactive)
            alorence Antoine Lorence
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes