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. Using CMake (was "fake Qt installation")
Forum Updated to NodeBB v4.3 + New Features

Using CMake (was "fake Qt installation")

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
23 Posts 4 Posters 3.4k Views 2 Watching
  • 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.
  • sierdzioS Offline
    sierdzioS Offline
    sierdzio
    Moderators
    wrote on last edited by
    #2

    You have probably seen it, but some hints are mentioned in an old Mailing List thread. Plus a longer one here.

    Looks like you only need fake Qt when using qmake. Both QBS and cmake should work fine, without a need for fake Qt.

    (Z(:^

    1 Reply Last reply
    1
    • mzimmersM Offline
      mzimmersM Offline
      mzimmers
      wrote on last edited by
      #3

      Thank you...so, I've tried to set up the project for CMake (a first for me). I get an untitled folder under my project directory. When I open the project, I get this:

      Running "C:\esp32-toolchain\.espressif\tools\cmake\3.13.4\bin\cmake.exe -E server "--pipe=\\.\pipe\{c5f30b1f-ced0-4313-935c-83bd5872c4df}" --experimental" in C:\Users\mzimmers\AppData\Local\Temp\QtCreator-cKHiFU\qtc-cmake-YjObqBra.
      Running "C:\esp32-toolchain\.espressif\tools\cmake\3.13.4\bin\cmake.exe -E server "--pipe=\\.\pipe\{be3679ab-1dcf-4147-8abe-eecb55e086b7}" --experimental" in C:\Users\mzimmers\AppData\Local\Temp\QtCreator-cKHiFU\qtc-cmake-OMdFObmW.
      Running "C:\esp32-toolchain\.espressif\tools\cmake\3.13.4\bin\cmake.exe -E server "--pipe=\\.\pipe\{2df6a5be-e389-4fa0-b0d8-4df8a8ace822}" --experimental" in C:\Users\mzimmers\AppData\Local\Temp\QtCreator-cKHiFU\qtc-cmake-ldSxNodR.
      Running "C:\esp32-toolchain\.espressif\tools\cmake\3.13.4\bin\cmake.exe -E server "--pipe=\\.\pipe\{bddc1a3b-8705-4966-b0dd-dd2cc300714e}" --experimental" in C:\Users\mzimmers\AppData\Local\Temp\QtCreator-cKHiFU\qtc-cmake-VKpGXbrm.
      Parsing of CMake project failed: Connection to CMake server lost.
      Parsing of CMake project failed: Connection to CMake server lost.
      Parsing of CMake project failed: Connection to CMake server lost.
      Parsing of CMake project failed: Connection to CMake server lost.
      

      I'm totally new to this, but when I see words like "--pipe" I think Linux (I'm on Windows 10), and I'm not sure of what to make of "--experimental."

      It would be really cool to get this working, but if it's going to be too much trouble, I'll just give up on it.

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #4

        I think Qt Creator requires newer version of cmake. Currently you can download 3.17 using Qt Online installer.

        (Z(:^

        1 Reply Last reply
        0
        • mzimmersM Offline
          mzimmersM Offline
          mzimmers
          wrote on last edited by mzimmers
          #5

          OK, I installed a newer version through the maintenance tool. Now I get this error:

          C:\Qt\Tools\CMake_32\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake:60: error: The C compiler "C:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/mzimmers/AppData/Local/Temp/QtCreator-gFJIIs/qtc-cmake-PihZJImV/CMakeFiles/CMakeTmp Run Build Command(s):jom /nologo cmTC_69f0c\fast && jom: parallel job execution disabled for Makefile C:\Qt\Tools\QtCreator\bin\jom.exe  -f CMakeFiles\cmTC_69f0c.dir\build.make /nologo -L CMakeFiles\cmTC_69f0c.dir\build Building C object CMakeFiles/cmTC_69f0c.dir/testCCompiler.c.obj C:\esp32-toolchain\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe    -o CMakeFiles\cmTC_69f0c.dir\testCCompiler.c.obj   -c C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\testCCompiler.c Linking C executable cmTC_69f0c.exe C:\Qt\Tools\CMake_32\bin\cmake.exe -E rm -f CMakeFiles\cmTC_69f0c.dir/objects.a C:\Qt\Tools\mingw810_32\bin\ar.exe cr CMakeFiles\cmTC_69f0c.dir/objects.a @CMakeFiles\cmTC_69f0c.dir\objects1.rsp C:\esp32-toolchain\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe      -Wl,--whole-archive CMakeFiles\cmTC_69f0c.dir/objects.a -Wl,--no-whole-archive  -o cmTC_69f0c.exe -Wl,--out-implib,libcmTC_69f0c.dll.a -Wl,--major-image-version,0,--minor-image-version,0 c:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version' c:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: use the --help option for usage information collect2.exe: error: ld returned 1 exit status jom: C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\CMakeFiles\cmTC_69f0c.dir\build.make [cmTC_69f0c.exe] Error 1 jom: C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\Makefile [cmTC_69f0c\fast] Error 2
          

          I have NO idea what I'm even looking at here. Can you decode this?

          Thanks...

          jsulmJ 1 Reply Last reply
          0
          • mzimmersM mzimmers

            OK, I installed a newer version through the maintenance tool. Now I get this error:

            C:\Qt\Tools\CMake_32\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake:60: error: The C compiler "C:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/mzimmers/AppData/Local/Temp/QtCreator-gFJIIs/qtc-cmake-PihZJImV/CMakeFiles/CMakeTmp Run Build Command(s):jom /nologo cmTC_69f0c\fast && jom: parallel job execution disabled for Makefile C:\Qt\Tools\QtCreator\bin\jom.exe  -f CMakeFiles\cmTC_69f0c.dir\build.make /nologo -L CMakeFiles\cmTC_69f0c.dir\build Building C object CMakeFiles/cmTC_69f0c.dir/testCCompiler.c.obj C:\esp32-toolchain\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe    -o CMakeFiles\cmTC_69f0c.dir\testCCompiler.c.obj   -c C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\testCCompiler.c Linking C executable cmTC_69f0c.exe C:\Qt\Tools\CMake_32\bin\cmake.exe -E rm -f CMakeFiles\cmTC_69f0c.dir/objects.a C:\Qt\Tools\mingw810_32\bin\ar.exe cr CMakeFiles\cmTC_69f0c.dir/objects.a @CMakeFiles\cmTC_69f0c.dir\objects1.rsp C:\esp32-toolchain\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-gcc.exe      -Wl,--whole-archive CMakeFiles\cmTC_69f0c.dir/objects.a -Wl,--no-whole-archive  -o cmTC_69f0c.exe -Wl,--out-implib,libcmTC_69f0c.dll.a -Wl,--major-image-version,0,--minor-image-version,0 c:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version' c:/esp32-toolchain/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: use the --help option for usage information collect2.exe: error: ld returned 1 exit status jom: C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\CMakeFiles\cmTC_69f0c.dir\build.make [cmTC_69f0c.exe] Error 1 jom: C:\Users\mzimmers\AppData\Local\Temp\QtCreator-gFJIIs\qtc-cmake-PihZJImV\CMakeFiles\CMakeTmp\Makefile [cmTC_69f0c\fast] Error 2
            

            I have NO idea what I'm even looking at here. Can you decode this?

            Thanks...

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #6

            @mzimmers It tells you that xtensa-esp32-elf-gcc.exe compiler can't compile a simple program. Is this the compiler you want to use?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            mzimmersM 1 Reply Last reply
            0
            • jsulmJ jsulm

              @mzimmers It tells you that xtensa-esp32-elf-gcc.exe compiler can't compile a simple program. Is this the compiler you want to use?

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #7

              @jsulm yes it is; that's in the toolchain for the ESP-IDF.

              jsulmJ 1 Reply Last reply
              0
              • mzimmersM mzimmers

                @jsulm yes it is; that's in the toolchain for the ESP-IDF.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @mzimmers Actually it is not compiler failing, but linker: xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version'

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                mzimmersM 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @mzimmers Actually it is not compiler failing, but linker: xtensa-esp32-elf/bin/ld.exe: unrecognized option '--major-image-version'

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #9

                  @jsulm I see. So, whereabouts should I look for that option? I don't see it in any of my Creator options.

                  jsulmJ 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    @jsulm I see. So, whereabouts should I look for that option? I don't see it in any of my Creator options.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @mzimmers I don't know.
                    What is actually the compiler version?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    mzimmersM 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @mzimmers I don't know.
                      What is actually the compiler version?

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #11

                      @jsulm presumably 8.2.0:
                      toolchain.PNG

                      1 Reply Last reply
                      0
                      • mzimmersM Offline
                        mzimmersM Offline
                        mzimmers
                        wrote on last edited by
                        #12

                        I found this which seems to do a pretty good job of describing how to translate a qmake file into a CMake file. But what it doesn't say is how to "tell" Creator that a particular project to use CMake instead of qmake. How do I do that?

                        Thanks...

                        1 Reply Last reply
                        0
                        • sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #13

                          You need to close your (qmake) project and then open your new CMakeLists.txt in Qt Creator.

                          (Z(:^

                          1 Reply Last reply
                          1
                          • mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #14

                            Thanks, sierdzio. I also resolved the problem with that TARGET_VERSION_MAJOR -- it turns out that it's just a symbol that the ESP32 toolchain expects to have. I just defined them in my CMakeLists.txt file:

                            SET(TARGET_VERSION_MAJOR 0)
                            SET(TARGET_VERSION_MINOR 0)
                            

                            And that eliminated that error.

                            So now, how do I inform CMake that my sources are in a directory main under the root-level directory?

                            1 Reply Last reply
                            0
                            • sierdzioS Offline
                              sierdzioS Offline
                              sierdzio
                              Moderators
                              wrote on last edited by
                              #15

                              https://doc.qt.io/qt-5/cmake-get-started.html

                              You specify the sources in add_executable call (if you are building an executable).

                              (Z(:^

                              mzimmersM 1 Reply Last reply
                              1
                              • sierdzioS sierdzio

                                https://doc.qt.io/qt-5/cmake-get-started.html

                                You specify the sources in add_executable call (if you are building an executable).

                                mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on last edited by
                                #16

                                @sierdzio thank you for the link. I understand that there needs to be an entry for every source file somewhere. The CMakeLists.txt file in the main directory has that already. So, what is the correct entry in the CMakeLists.txt file for the top-level (above main/) to tell the build to look in main for these sources? Surely I don't need a SET_SOURCES to re-list those files? So, what's the second argument to add_executable()?

                                Thank you.

                                sierdzioS 1 Reply Last reply
                                0
                                • mzimmersM mzimmers

                                  @sierdzio thank you for the link. I understand that there needs to be an entry for every source file somewhere. The CMakeLists.txt file in the main directory has that already. So, what is the correct entry in the CMakeLists.txt file for the top-level (above main/) to tell the build to look in main for these sources? Surely I don't need a SET_SOURCES to re-list those files? So, what's the second argument to add_executable()?

                                  Thank you.

                                  sierdzioS Offline
                                  sierdzioS Offline
                                  sierdzio
                                  Moderators
                                  wrote on last edited by
                                  #17

                                  @mzimmers said in Using CMake (was "fake Qt installation"):

                                  @sierdzio thank you for the link. I understand that there needs to be an entry for every source file somewhere. The CMakeLists.txt file in the main directory has that already. So, what is the correct entry in the CMakeLists.txt file for the top-level (above main/) to tell the build to look in main for these sources?

                                  include or add_subdirectory, depending on your needs.

                                  Surely I don't need a SET_SOURCES to re-list those files? So, what's the second argument to add_executable()?

                                  First argument is the executable name. All subsequent arguments are files which cmake should consider during build.

                                  (Z(:^

                                  1 Reply Last reply
                                  1
                                  • K Offline
                                    K Offline
                                    kuzulis
                                    Qt Champions 2020
                                    wrote on last edited by kuzulis
                                    #18

                                    Try QBS instead of CMake and do not suffer (if no any special requirements). In this case you don't need in this hard manipulations (with CMake you need in a custom toolchain file, in a separate Make or Ninja utilities and so on)...

                                    PS: F.e. I use QBS with ESP8266 && non-os-sdk and all fine. :)

                                    jsulmJ mzimmersM 2 Replies Last reply
                                    0
                                    • K kuzulis

                                      Try QBS instead of CMake and do not suffer (if no any special requirements). In this case you don't need in this hard manipulations (with CMake you need in a custom toolchain file, in a separate Make or Ninja utilities and so on)...

                                      PS: F.e. I use QBS with ESP8266 && non-os-sdk and all fine. :)

                                      jsulmJ Offline
                                      jsulmJ Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #19

                                      @kuzulis Isn't QBS dying and CMake will be default in Qt6?

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • K Offline
                                        K Offline
                                        kuzulis
                                        Qt Champions 2020
                                        wrote on last edited by kuzulis
                                        #20

                                        QBS is still not dead, it is now being actively developed by the open source community and has a many changes.

                                        For QBS, it’s not a problem that CMake is the default Qt build system, it still supports in QtCreator. QBS is not only for Qt, but for everything else, especially for a bare metal programming (especially it is a best choose for a DIY projects, because it support a lot of architectures and toolchains).

                                        jsulmJ 1 Reply Last reply
                                        2
                                        • K kuzulis

                                          QBS is still not dead, it is now being actively developed by the open source community and has a many changes.

                                          For QBS, it’s not a problem that CMake is the default Qt build system, it still supports in QtCreator. QBS is not only for Qt, but for everything else, especially for a bare metal programming (especially it is a best choose for a DIY projects, because it support a lot of architectures and toolchains).

                                          jsulmJ Offline
                                          jsulmJ Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #21

                                          @kuzulis OK, didn't know QBS is actively developed

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          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