Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLion - Changing the default build directory

I've been having issues with changing the build directory via CLion. I've tried: set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin") but it does not seem to change and remains the same (/home/adil/.clion10/system/cmake/generated/c05c962b/c05c962b/Debug/Project).
I have also tried the workaround specified here, but that too does not seem to work.

Does anyone have a solution for this problem?

like image 613
Adil Avatar asked Nov 08 '14 17:11

Adil


People also ask

How do I change the build directory in CLion?

CLion v2016. To change build output path, go to Build, Execution, Deployment | CMake settings and set it there. Alternatively, you can configure the RUNTIME_OUTPUT_DIRECTORY property in your CMakeLists. txt file.

How do I change Cmakelist to CLion?

Go to Settings / Preferences | Build, Execution, Deployment | CMake. , and CLion will add a new profile to the list. Change the profile name, build type, and other settings as required.


2 Answers

You need to prefix your bin with the path to the current directory your project resides in. You can use ${CMAKE_CURRENT_SOURCE_DIR}

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") 

Be sure to add this before related add_executable directive(s) in your CMakeLists.txt file.

like image 150
wiped Avatar answered Sep 18 '22 11:09

wiped


Go to Settings -> CMake and specify relative or absolute pass where you would like your build files to be stored in 'Build output path' field. For instance ./bin will output build files in YourProject/bin/Debug/yourExeFile.exe

enter image description here

like image 31
Vlad Bezden Avatar answered Sep 18 '22 11:09

Vlad Bezden