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.3k 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.
  • 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
                        • K Offline
                          K Offline
                          kuzulis
                          Qt Champions 2020
                          wrote on last edited by
                          #22

                          @jsulm ,

                          Surprize:

                          • https://codereview.qt-project.org/q/project:qbs%252Fqbs+status:merged
                          • https://codereview.qt-project.org/q/project:qbs%252Fqbs+status:open

                          :))

                          1 Reply 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. :)

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

                            @kuzulis thank you for the suggestion. The application I've written makes full use of the ESP IDF, which I believe is exclusively CMake. I don't think converting the entire build system to QBS is the right way to go. I'll continue to plod ahead with the CMake effort, since it appears to be the wave of the future. I do appreciate the suggestion, though.

                            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