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

CMake fails to configure apps with -Werror on iOS

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.2.2
    • Build System: CMake
    • None
    • iOS/tvOS/watchOS

      (Using cmake 3.21 from the QtSDK installation, Apple clang 13.0.0.13000029)

      I created a new Quick2 project in QtCreator and changed CMAKE_CXX_STANDARD to 20.

      After this, cmake fails to configure (both native iOS and simulator) with a weird error that it couldn't detect HAVE_GETTIME. I traced it via CMakeError.log to the flags passed to clang when compiling code snippets via check_cxx_source_compiles. The actual problem is in FindWrapRt.cmake, where the compile snippet has int main(int argc, char *argv[]), but both argc and argv are unused.

      In C++ 11 mode, clang is invoked with: ... --std\=gnu11 ..., but in C++20 mode, clang is invoked with: ... -Wall -Wextra -Werror -pedantic --std\=gnu++2a ...

      I couldn't figure out where these additional flags are coming from.

      I then tried to simply fix this by removing argument names, but this leads down a real rabbit hole: I found the same problem in FindGLESv2.cmake, but this wasn't enough there: that test is calling deprecated functions, which result in a warning, which in the end results in a compile error thanks to -Werror.

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

            qtbuildsystem Qt Build System Team
            rgriebl Robert Griebl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes