Qt – where does qtcreator with cmake store run and build settings, and how to set via script

cmakenfsqtqt-creator

In my usage at least, I sometimes delete my CMake build folder and create a new one, or have multiple build folders (one per computer) but only one source folder (nfs mount).

From what I can tell, QT Creator saves settings into CMakeLists.txt.user inside the source tree, and some others settings into the 'project.cbp' file in the build folder. If I set settings from the GUI, they are lost after wipe/create build folder. Fair enough, but I'd like to use a script to set them up again when a new build is made.

So, how do I:

a) make QT Creator write the CMakeLists.txt.user folder somewhere other than the source tree so that machine-specific settings are kept (e.g. debug on the development computer, release on the test computer) ?

b) read/write the build and run settings from QT Creator project, such as debug arguments for each executable and extra build commands (e.g. -j8) ?

Then I would do something like "execute_process( … )" in CMakeLists.txt to set some debug and build arguments for the QT Creator project.

Best Answer

Ah, actually the command args, build settings, and related items are set in the CMakeLists.txt.user from QTCreator...

for example:

<valuemap key="ProjectExplorer.Target.RunConfiguration.1" type="QVariantMap">
<value key="CMakeProjectManager.BaseEnvironmentBase" type="int">2</value>
<value key="CMakeProjectManager.CMakeRunConfiguation.Title" type="QString">matching_test</value>
<value key="CMakeProjectManager.CMakeRunConfiguration.Arguments" type="QString">camera.pklogitech.yml  0   .</value>

so the args that are used are " camera.pklogitech.yml 0 . " for this binary's entry...

So I guess a script could be made to go in and set those values by default... too bad QT Creator doesn't provide a nicer interface to import them.

Related Topic