Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change build directory in QtCreator?

I have a cmake based C++ project done with QtCreator. I wrote the CMakeLists.txt files manually. When building either from the command line of from QtCreator, I get this directory structure, as expected:

MyProj/            - source code
MyProj_build/      - object files and executable; I launch cmake from here

Now I would like the build directory to be on a different disk (a ram disk):

/PathToRamDisk/MyProj_build/

When building from the command line, I launch cmake/make from the new build directory, and all the generated files are located in that directory. Fine.

From QtCreator, even if I change the build path to the new one (Options/Build & Run/General/Default build directory), the build is still done in the old directory. Is there another path to change? Where?

Platform: QtCreator 3.3.0, Mac OSX

like image 418
Pietro Avatar asked Feb 27 '15 12:02

Pietro


2 Answers

You can click the Project button on the left side of QtCreator, then you can specify the output directory. Notice, the default is for debug version, you need to specify the release version folder either. output folder

Once you set a different folder, you will see that you need to rerun the cmake command to generate these files. This should work, I also use it on Mac.

like image 84
Cui Heng Avatar answered Sep 28 '22 01:09

Cui Heng


You can change default build directory template By changing the Default build directory setting in Options->Build & Run.

Or directly in ~/.config/QtProject/QtCreator.ini:

[...]

[Directories]
BuildDirectory.Template=.../%{JS: Util.asciify("build/%{CurrentProject:Name}/%{CurrentKit:FileSystemName}-%{CurrentBuild:Name}")}

[...]
like image 41
Garcia Sylvain Avatar answered Sep 28 '22 02:09

Garcia Sylvain