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

Qt5 CMake integration does not expose minimum deployment target with which Qt was built

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 5.15.1, 6.0.0
    • 5.6.3, 5.9.3, 5.10.1, 5.11.0 Alpha
    • Build System: CMake
    • None
    • macOS 10.12
    • macOS

    Description

      When building a Qt application with CMake, no -mmacosx-version-min flag is passed to compiled objects.

      In qmake's case it uses the value of QMAKE_MACOSX_DEPLOYMENT_TARGET defined in mkspecs/macx-clang/qmake.conf, and passes that value along to -mmacosx-version-min when compiling an object file.

      I think the cmake integration should at least expose the value of QMAKE_MACOSX_DEPLOYMENT_TARGET as a variable or target property, and at best actually simulates qmake's logic.

      Small sample CMakeLists.txt file.

      cmake_minimum_required(VERSION 3.1)
      project(foo)
      find_package(Qt5 5.6 REQUIRED COMPONENTS Core)
      add_executable(${PROJECT_NAME} main.cpp)
      target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core)
      

      main.cpp

      #include <QCoreApplication>
      int main(int argc, char*argv[]) {
          QCoreApplication app(argc, argv);
          return 0;
      }
      

      qmake project

      TEMPLATE = app
      TARGET = bla
      SOURCES = main.cpp
      QT += core
      

      Compiling with cmake:

      [ 50%] Building CXX object CMakeFiles/bla.dir/main.cpp.o
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DQT_CORE_LIB -DQT_NO_DEBUG -isystem /Volumes/T3/Dev/qt/qt59_built/qtbase/include -isystem /Volumes/T3/Dev/qt/qt59_built/qtbase/include/QtCore -isystem /Volumes/T3/Dev/qt/qt59_built/qtbase/../../qt59_source/qtbase/mkspecs/macx-clang  -fPIC -std=gnu++11 -o CMakeFiles/bla.dir/main.cpp.o -c /Volumes/T3/Dev/pyside/old_pyside_setup_circa_2017_before_merge/foo/main.cpp
      

      Compiling with qmake:

      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../../qt/qt59_built/qtbase/include -I../../../qt/qt59_built/qtbase/include/QtGui -I../../../qt/qt59_built/qtbase/include/QtCore -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I../../../qt/qt59_source/qtbase/mkspecs/macx-clang -o main.o main.cpp
      

      Attachments

        Issue Links

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

          Activity

            People

              krf Kevin Funk
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes