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 Compiler headers
QtWS25 Last Chance

Qt Creator Compiler headers

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
qt creatorcompilercmake
4 Posts 3 Posters 600 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.
  • K Offline
    K Offline
    KSergeiP
    wrote on last edited by KSergeiP
    #1

    I configured the kit with Compiler = No, because... my CMAKE project takes TOOLCHAIN_PATH to determine which compiler to use
    I can't explicitly specify the compiler due to the project structure
    The project is being assembled, there are no errors.
    Cmake detects the compiler correctly:
    [cmake] -- The ASM compiler identification is GNU
    [cmake] -- Found assembler: C:/arm-gnu-toolchain-13.2/bin/arm-none-eabi-gcc.exe
    [cmake] -- The C compiler identification is GNU 13.2.1
    [cmake] -- Detecting C compiler ABI info
    [cmake] -- Detecting C compiler ABI info - done
    [cmake] -- Check for working C compiler: C:/arm-gnu-toolchain-13.2/bin/arm-none-eabi-gcc.exe - skipped
    [cmake] -- Detecting C compile features
    [cmake] -- Detecting C compile features - done
    [cmake] -- The CXX compiler identification is GNU 13.2.1
    [cmake] -- Detecting CXX compiler ABI info
    [cmake] -- Detecting CXX compiler ABI info - done
    [cmake] -- Check for working CXX compiler: C:/arm-gnu-toolchain-13.2/bin/arm-none-eabi-g++.exe - skipped
    [cmake] -- Detecting CXX compile features
    [cmake] -- Detecting CXX compile features - done

    But Qt Creator print a warning: ":-1: warning: The project contains C source files, but the currently active kit has no C compiler. The code model will not be fully functional."
    And compiler header files are highlighted as undefined.
    How can I force Qt Creator to use a compiler that has defined and uses the CMAKE script?
    cmake script adds CMAKE_CXX_COMPILER to the cache

    cristian-adamC 1 Reply Last reply
    0
    • S Offline
      S Offline
      SimonSchroeder
      wrote on last edited by
      #2

      I guess there is no harm in setting a compiler for the kit. If you want to use Qt Creator to build your project as well, you can provide your own command line to be used for compilation and check which environment variables are set during build (maybe removing any environment variables that specify the compiler path). This can all be found when clicking on Project on the left-hand pane.

      K 1 Reply Last reply
      0
      • S SimonSchroeder

        I guess there is no harm in setting a compiler for the kit. If you want to use Qt Creator to build your project as well, you can provide your own command line to be used for compilation and check which environment variables are set during build (maybe removing any environment variables that specify the compiler path). This can all be found when clicking on Project on the left-hand pane.

        K Offline
        K Offline
        KSergeiP
        wrote on last edited by KSergeiP
        #3

        @SimonSchroeder It is not comfortable. For me, CMAKE automatically finds the required compiler by name, version and OS type. You can specify it on different PCs each time, but this is unlikely to be correct.
        The CMAKE project does not require kits; just create several Build configurations

        1 Reply Last reply
        0
        • K KSergeiP

          I configured the kit with Compiler = No, because... my CMAKE project takes TOOLCHAIN_PATH to determine which compiler to use
          I can't explicitly specify the compiler due to the project structure
          The project is being assembled, there are no errors.
          Cmake detects the compiler correctly:
          [cmake] -- The ASM compiler identification is GNU
          [cmake] -- Found assembler: C:/arm-gnu-toolchain-13.2/bin/arm-none-eabi-gcc.exe
          [cmake] -- The C compiler identification is GNU 13.2.1
          [cmake] -- Detecting C compiler ABI info
          [cmake] -- Detecting C compiler ABI info - done
          [cmake] -- Check for working C compiler: C:/arm-gnu-toolchain-13.2/bin/arm-none-eabi-gcc.exe - skipped
          [cmake] -- Detecting C compile features
          [cmake] -- Detecting C compile features - done
          [cmake] -- The CXX compiler identification is GNU 13.2.1
          [cmake] -- Detecting CXX compiler ABI info
          [cmake] -- Detecting CXX compiler ABI info - done
          [cmake] -- Check for working CXX compiler: C:/arm-gnu-toolchain-13.2/bin/arm-none-eabi-g++.exe - skipped
          [cmake] -- Detecting CXX compile features
          [cmake] -- Detecting CXX compile features - done

          But Qt Creator print a warning: ":-1: warning: The project contains C source files, but the currently active kit has no C compiler. The code model will not be fully functional."
          And compiler header files are highlighted as undefined.
          How can I force Qt Creator to use a compiler that has defined and uses the CMAKE script?
          cmake script adds CMAKE_CXX_COMPILER to the cache

          cristian-adamC Online
          cristian-adamC Online
          cristian-adam
          wrote on last edited by
          #4

          You could use CMakePresets.json file to specify a CMake Preset Kit.

          Qt Creator would then use the information from the CMakePresets.json file and create a kit for you.

          Something like:

          {
            "version": 4
            },
            "configurePresets": [
              {
                "name": "arm-gnu-toolchain",
                "displayName": "Arm GNU GCC 13.2",
                "generator": "Ninja",
                "toolchainFile" : "C:/arm-gnu-toolchain-13.2/toolchain.cmake",
                "cacheVariables": {
                  "CMAKE_C_COMPILER": "arm-none-eabi-gcc.exe",
                  "CMAKE_CXX_COMPILER": "arm-none-eabi-g++.exe"
                }
              }
            ]
          }
          

          See https://doc.qt.io/qtcreator/creator-build-settings-cmake-presets.html and various Qt Creator CMake blog entries for more details.

          1 Reply Last reply
          1

          • Login

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