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

Cmake doesn't take into consideration value of -hostprefix

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.1.0 Beta 1
    • 5.0.0
    • Build tools: Other
    • None
    • Cross compilation environments
    • eebf42cc0d99534e26da7510c3e72fba339b9829,e6bade8f87f849c4c155d5f527c94ada596cf193

    Description

      When building Qt, you can specify where you would like host tools too be installed, like qmake, moc, rcc, etc by using the -hostprefix configuration argument. This makes sense when cross-compiling because these tools are built for the host system (ex x86_64). That way the libraries are cross compiled for whatever arch/system, and installed into the -prefix (sysroot), and host tools are installed else where.

      The problem is that the generated cmake files define the location of the host tools relative to their own location.

      Qt5CoreConfigExtras.cmake
      get_filename_component(_qt5_corelib_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
      
      if (NOT TARGET Qt5::qmake)
          add_executable(Qt5::qmake IMPORTED)
      
          set_target_properties(Qt5::qmake PROPERTIES
              IMPORTED_LOCATION "${_qt5_corelib_install_prefix}/bin/qmake"
          )
      endif()
      
      if (NOT TARGET Qt5::moc)
          add_executable(Qt5::moc IMPORTED)
      
          set_target_properties(Qt5::moc PROPERTIES
              IMPORTED_LOCATION "${_qt5_corelib_install_prefix}/bin/moc"
          )
          # For CMake automoc feature
          get_target_property(QT_MOC_EXECUTABLE Qt5::moc LOCATION)
      endif()
      

      This location is inside of the -prefix location, which will place moc within the sysroot. When -hostprefix has been defined during configuration, moc wont exist in this hard-coded location, so when these macro files are generated they need to take into consideration the value of -hostprefix.

      Attachments

        Issue Links

          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)
              janichol Andy Nichols
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes