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

CMake library install target does not copy binaries on iOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.3.1, 6.4.0 Beta1
    • 6.1.2, 6.2.3, 6.3.0
    • Build System: CMake
    • None
    • QtCreator v4.15.1

      cmake version 3.20.5
    • iOS/tvOS/watchOS
    • c0188b2dbd (qt/qtbase/dev) c0188b2dbd (qt/tqtc-qtbase/dev) b5254073fd (qt/qtbase/6.3) b5254073fd (qt/tqtc-qtbase/6.3) b5254073fd (qt/qtbase/6.3.1)

    Description

      When building a simple library project with "install" target:

      CMakeLists.txt

      cmake_minimum_required(VERSION 3.10)
      
      project(Test)
      
      add_library(Test STATIC test.cpp)
      
      install(TARGETS Test DESTINATION "${PROJECT_BINARY_DIR}/expexted_install_dir")
      

      test.cpp

      class Test{
      
      };
      

      ...then the binaries are not copied because the build type is changed to "Debug-iphoneos" instead of a plain "Debug" but several CMake generated files don't support that name:

      • cmake_install.cmake
        "${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$"
      • Debug-iphoneos/install.build/Script-93426DA6A4AC2C2AC9CE883C.sh
        /Applications/CMake.app/Contents/bin/cmake -DBUILD_TYPE=$CONFIGURATION$EFFECTIVE_PLATFORM_NAME -P cmake_install.cmake
        

       

      CMake by default handles EFFECTIVE_PLATFORM_NAME correctly because building the project for iOS without Qt works correctly and the install script is generated differently where DBUILD_TYPE and DEFFECTIVE_PLATFORM_NAME are separated:

      • Debug-iphoneos/install.build/Script-93426DA6A4AC2C2AC9CE883C.sh
        /Applications/CMake.app/Contents/bin/cmake -DBUILD_TYPE=$CONFIGURATION -DEFFECTIVE_PLATFORM_NAME=$EFFECTIVE_PLATFORM_NAME -P cmake_install.cmake
        

       

      So it must be in the way Qt configures CMake and I narrowed it down to the following argument. It is caused by CMAKE_TOOLCHAIN_FILE

      CMAKE_TOOLCHAIN_FILE Qt/6.1.2/ios/lib/cmake/Qt6/qt.toolchain.cmake
      

      ...but could not go deeper anymore.

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-95381
          # Subject Branch Project Status CR V

          Activity

            People

              alexandru.croitor Alexandru Croitor
              kiibimees Lauri Laanmets
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes