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. QtCreator 20 defaulting to Unix makefilesfor cmake on Ubuntu
Qt 6.11 is out! See what's new in the release blog

QtCreator 20 defaulting to Unix makefilesfor cmake on Ubuntu

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 229 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.
  • C Offline
    C Offline
    ChortleMortal
    wrote last edited by ChortleMortal
    #1

    Using a clean installation of Ubuntu, I installed latest Qt and used QtCreator to open my cmake project. I see that it defaults to the CMAKE_GENERATOR being Unix Makefiles, so is only building the project on one core. So how do I switch it to using Ninja? There seems to be three places to change. First is the "Kit Configuration" dialog. I can set Ninja there, but it seems to make no difference. Then there is the Initial Configuration and Current Configuration tabs. Editing the fields CMAKE_GENERATOTR in both those tabs, causes the entry to go red in color, but when I run cmake, they get changed back to Unix makefiles.

    This is the second new machine I have had this problem on. On the first I somehow after going round and round in circles, I managed to put /home/david/Qt/Tools/Ninja/ninja into the CMAKE_GEBERATOR field and have it stick there. It remains red in color, but the builds work. But on this second machine using trial and error I still cant make it stick, it always reverts to Unix makefiles even though Ninja is selected in Kit Configuration. Help would be appreciated.

    cristian-adamC 1 Reply Last reply
    1
    • C ChortleMortal

      Using a clean installation of Ubuntu, I installed latest Qt and used QtCreator to open my cmake project. I see that it defaults to the CMAKE_GENERATOR being Unix Makefiles, so is only building the project on one core. So how do I switch it to using Ninja? There seems to be three places to change. First is the "Kit Configuration" dialog. I can set Ninja there, but it seems to make no difference. Then there is the Initial Configuration and Current Configuration tabs. Editing the fields CMAKE_GENERATOTR in both those tabs, causes the entry to go red in color, but when I run cmake, they get changed back to Unix makefiles.

      This is the second new machine I have had this problem on. On the first I somehow after going round and round in circles, I managed to put /home/david/Qt/Tools/Ninja/ninja into the CMAKE_GEBERATOR field and have it stick there. It remains red in color, but the builds work. But on this second machine using trial and error I still cant make it stick, it always reverts to Unix makefiles even though Ninja is selected in Kit Configuration. Help would be appreciated.

      cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote last edited by
      #2

      @ChortleMortal This usually happens when you don't have ninja in PATH.

      macOS with homebrew has this issue too.

      My fix was to go to Preferences > Devices > Local PC and add /opt/homebrew/bin to the

      Search in directories
      field.

      macos-ninja.png

      The other option is to set the CMAKE_MAKE_PROGRAM CMake variable to your /path/to/ninja executable, whilst having CMAKE_GENERATOR set to Ninja.

      C 1 Reply Last reply
      2
      • cristian-adamC cristian-adam

        @ChortleMortal This usually happens when you don't have ninja in PATH.

        macOS with homebrew has this issue too.

        My fix was to go to Preferences > Devices > Local PC and add /opt/homebrew/bin to the

        Search in directories
        field.

        macos-ninja.png

        The other option is to set the CMAKE_MAKE_PROGRAM CMake variable to your /path/to/ninja executable, whilst having CMAKE_GENERATOR set to Ninja.

        C Offline
        C Offline
        ChortleMortal
        wrote last edited by
        #3

        @cristian-adam
        Thank you so much, Both your solutions work. Your posting t not only solves the problem for me but adds clarity as to what is happening.

        I set both CMAKE_GENERATOR and CMAKE_MAKE_PROGRAM and now cmake is running and building on all cores.

        After this I looked at the Devices tab in preferences and saw the relationship of the programs qtcreator uses and PATH. Coming from the windows environment I had never looked at this preference page before. All my entries were empty, meaning it used $PATH. qtinstaller puts ninja in Qt/Tools/Ninja but presumably does nothing to the path. So I set the path to ninja in the Devices page, then created a new session and used another repository, and this time it defaulted to Ninja, and of course worked perfectly

        Once again thanks,
        David

        1 Reply Last reply
        1
        • C ChortleMortal has marked this topic as solved
        • cristian-adamC Offline
          cristian-adamC Offline
          cristian-adam
          wrote last edited by
          #4

          And if you have Ninja installed via Qt SDK, you should have in your QtCreator.ini something like:

          [CMakeSpecificSettings]
          NinjaPath=/Users/cristian/Qt/Tools/Ninja//ninja    
          

          which should get CMAKE_MAKE_PROGRAM set to this value.

          1 Reply Last reply
          0

          • Login

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