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

qt-cmake can't be used to run CMake `--build` or `--install` modes, due to commandline injection of CMAKE_TOOLCHAIN_FILE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.2, 6.10.0 RC
    • Build System: CMake
    • None
    • Linux/Wayland, Linux/X11

      Due to the way the qt-cmake script injects its CMAKE_TOOLCHAIN_FILE argument into the cmake command line, the script is only usable to configure a CMake build system. It cannot be used to run subsequent commands like:

      qt-cmake --build _builddir_
      qt-cmake --install _builddir_
      

      ...because the -DCMAKE_TOOLCHAIN_FILE=... argument is not valid in those modes.

      I brought this up with the CMake team, and they suggested using the CMAKE_TOOLCHAIN_FILE environment variable to set the toolchain file, rather than the -D argument, since the environment variable is safe in any mode. (It'll simply be ignored, during --build or --install runs.)

      IOW,

      # Instead of ending qt-cmake with...
      exec "$cmake_path" -DCMAKE_TOOLCHAIN_FILE="$toolchain_path"  "$@"
      
      # use...
      CMAKE_TOOLCHAIN_FILE="$toolchain_path" exec "$cmake_path" "$@"
      

      ...and qt-cmake will become a complete cmake command alternative for Qt users.

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

            qtbuildsystem Qt Build System Team
            ferdnyc Frank Dana
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes