Unsolved Using CMake (was "fake Qt installation")
-
@jsulm presumably 8.2.0:
-
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...
-
You need to close your (qmake) project and then open your new CMakeLists.txt in Qt Creator.
-
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?
-
https://doc.qt.io/qt-5/cmake-get-started.html
You specify the sources in
add_executable
call (if you are building an executable). -
@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.
-
@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.
-
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. :)
-
@kuzulis Isn't QBS dying and CMake will be default in Qt6?
-
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).
-
@kuzulis OK, didn't know QBS is actively developed
-
-
@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.