How to change default build and intermediate locations?

When creating a C++ project or importing already existing CMake project, CLion by default uses the following directory as a build directory for both object files and final binaries on Mac.

> /Users/user_name/Library/Caches/clion11/cmake/generated/abcdef01234/abcdef01234/Debug/bin/name


There are multiple questions:

1) What is the best way to override this location?

2) Should I delete manually such temporary and binaries if a CLion project is no longer necessary?
     
3) What is CLion's recommended policy in regarding build directories? I'd rather to have them inside the project directory.

2 comments
Comment actions Permalink

Hi Carolle.

1. If you want to collect project binaries in the specific location, you can specify Build Output path on the Settings | Build, Execution, Deployment | CMake tab.
Having your build directory in the non-default location is not supported yet. In general it's not possible with CMake. Will changing IDE system path could be a suitable workaround for you?
Also please see the issue in the tracker: https://youtrack.jetbrains.com/issue/CPP-3374. Feel free to comment or upvote.

2. Unfortunately there is no GUI shortcut for it, you should remove it manually if you don’t need it anymore (please note that all project symbols and caches will be rebuilt next time you open it). I’ve created an issue in the tracker: https://youtrack.jetbrains.com/issue/CPP-4948. Please comment or upvote.

3. You can collect binaries in any location you want. Regarding fully in-source builds, CLion does not support it and it is considered as a bad practise by CMake authors so they discourage it. Placing resulting binaries in your sources is OK.

0
Comment actions Permalink

That's very detailed answers. Thank you very much!

0

Please sign in to leave a comment.