Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QT Creator cannot set cmake parameters
Forum Update on Monday, May 27th 2025

QT Creator cannot set cmake parameters

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JoVi
    wrote on 15 Oct 2020, 12:48 last edited by
    #1

    I have a bigger project which is managed by cmake. There are libraries (internal and imported etc.)

    To run cmake properly, a number of arguments/defines need to be given.

    For example a direct CMake run without parameters will always fail, because I need to select an OS and architecture.
    I can load the project with QT Creator and give the needed parameters, but they don't seem to apply.

    On the command line, this works fine with:

    john@doe:~/MY_PROJECT/build/arm64$cmake -DCMAKE_BUILD_TYPE=debug -DMY_PROJECT_OS=linux -DMY_PROJECT_ARCHITECTURE=arm64 ../..
    -- Adding directory: (...)
    -- Adding library: (...)
    (...)
    -- Configuring done
    -- Generating done
    -- Build files have been written to: (...)
    (...)
    john@doe:~/MY_PROJECT/build/arm64$make -j
    [  1%] Built target (...)
    (...)
    [100%] Built target MY_PROJECT
    

    In QT Creator I hit "File -> Open File or Project" and navigate to my main CMakeLists.txt.
    In "Configure Project" i select the Desktop kit with checked "Debug" and "Release" boxes.
    In the label beneath I set a path like
    "~/MY_PROJECT/build/debug"

    I then go with CTRL+5 to "Projects"
    There it directly gives me a yellow "!" and "The project was not parsed successfully."

    I proceed to add my arguments, like clicking "Add->String" and set all my arguments like that:

    KEY                          VALUE
    MY_PROJECT_OS                linux
    MY_PROJECT_ARCHITECTURE      arm64
    

    Clicking "Apply Configuration Changes" makes some bar appear in the bot right. It is too fast to read the text, but it is coloured in red.
    The Tab "1 Issues (1)" tells me "CMake process exited with exit code 1"
    The Tab "6 General Messages" tells me

    Running /usr/bin/cmake -S /home/john/MY_PROJECT -B /home/john/MY_PROJECT/build/debug in /home/john/MY_PROJECT/build/debug.
    CMake Error at CMakeLists.txt:20 (message):
      MY_PROJECT_OS not set!
    -- Configuring incomplete, errors occurred!
    CMake process exited with exit code 1.
    Elapsed time: 00:00.
    

    I repeated this multiple times, also with not clicking the "Apply Configuration Changes" button. Clearing all CMakeCache.txt, CMakeLists.txt.user* and CMakeFiles folder and repeating this did not help.
    Outcome is still the same - it looks like it does simply not give the parameters.

    I started Qt Creator from command line and this output occurs repeatedly:

    "Invalid codemodel file generated by CMake."
    SOFT ASSERT: "!task.description().isEmpty()" in file /build/qtcreator-sxgQ2x/qtcreator-4.13.1/src/plugins/projectexplorer/taskhub.cpp, line 155
    QFSFileEngine::open: No file name specified
    QIODevice::read (QFile, ""): device not open
    QFSFileEngine::open: No file name specified
    

    I am on Ubuntu 20.04 and have QT Creator 4.13.1 from the snap store.
    My Kit is more or less standard - did not change or set up anything (it still is labelled "Manual").
    It uses Qt 5.12.8 and system Cmake from /usr/bin/cmake (3.16.3)

    Can you guys help me set parameters for CMake?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 15 Oct 2020, 13:11 last edited by
      #2

      Try adding your args to "Initial CMake parameters" line edit, it's just above the config list you are modifying in Qt Creator UI.

      (Z(:^

      J 1 Reply Last reply 15 Oct 2020, 13:35
      0
      • S sierdzio
        15 Oct 2020, 13:11

        Try adding your args to "Initial CMake parameters" line edit, it's just above the config list you are modifying in Qt Creator UI.

        J Offline
        J Offline
        JoVi
        wrote on 15 Oct 2020, 13:35 last edited by
        #3

        @sierdzio I have added my parameters in the above config like

        -DMY_PROJECT_OS:STRING=linux
        -DMY_PROJECT_ARCHITECTURE:STRING=arm64
        

        But output is exactly the same.
        I double checked spelling and copied every variable name

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 16 Oct 2020, 06:01 last edited by
          #4

          That's very weird! Try removing the build directory completely, then check build settings and re-run CMake in Qt Creator.

          If that fails, please report it on Qt bug tracker.

          (Z(:^

          J 1 Reply Last reply 16 Oct 2020, 08:25
          0
          • S sierdzio
            16 Oct 2020, 06:01

            That's very weird! Try removing the build directory completely, then check build settings and re-run CMake in Qt Creator.

            If that fails, please report it on Qt bug tracker.

            J Offline
            J Offline
            JoVi
            wrote on 16 Oct 2020, 08:25 last edited by JoVi
            #5

            @sierdzio Thanks for your answer.
            I have closed QT-Creator. Deleted the debug and release directories in ~/MY_PROJECT/build and reopened QT-Creator.
            The variables set like above are still in the "Initial CMake parameters", however, the type changed from STRING to INTERNAL.

            If I run "Build -> Rescan Project" or "Build -> Run CMake" it both fails with telling me, I did not set the parameters.

            I will open a bug report
            Edit: It is here https://bugreports.qt.io/browse/QTCREATORBUG-24796

            1 Reply Last reply
            1

            1/5

            15 Oct 2020, 12:48

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved