Martin Vymazal Martin Vymazal - 1 year ago 100
C++ Question

QtCreator 4 and CMake parameters

I used to open a CMake-based C++ project with QtCreator and pass my custom CMake command line parameters when configuring the project. In the recent versions of QtCreator (QtCreator 4 to be precise), this does not seem to be possible anymore - QtCreator configures the project with its own set of CMake variables and their default values. This is extremely annoying, because the only way to change the values of certain CMake variables is to click on 'Projects' and modify the variables one by one, which is really tedious. I have the configuration parameters for specific machine and setup on that machine in a text file that I could just paste in the configuration dialog of Qtcreator and then run CMake, but this dialog now disappeared. Do you know if there's a way of passing custom CMake values while opening a new project?

I tried to clean the build directory, remove CMakeLists.txt.user in the source tree, run CMake with my parameters and then open the project with QtCreator. Unfortunately, QtCreator ignores the cached values and generates its own ...

Answer Source

"Tools" > "Options" > "Build & Run" > "Your kit" > "CMake configuration"

Add a line and rebuild. You can go the short way Ctrl+5 (Projects mode) > "Manage Kits...", too.