Customizing the build/run process

So I downloaded CLion today and started trying to get my company project working in it. This is already a well-established project that we've been working on for well over a year, and has a reasonably defined build process using cmake. I have been able to build the project, and that seems to work, however I'm a little bit confused about how running the actual project works. Oddly enough, I cannot run the actual software by using the run command - however, I am able to get it to run with the debug command. It looks like, when I try to run it, CLion executes the binary in a folder that looks something like /home/developer/.clion10/system/cmake/generated/62f2c3c6/62f2c3c6/Debug/output/bin/<target>. That's a little problematic for me, as I need to specify some paths relative to the binary in an environment variable and a argument - additionally we have things in the program itself that create log files, for example, relative to the executeable. So the question is

#1 is there a token or special variable I can use to specify the build path in my build parameters?
#2 is there a way to specify the actual build path to something of my choosing rather than a random folder deep in clion folder structure?



CLion takes all the information from cmake so you can use usual CMake variables to specify this like CMAKE_BINARY_DIR.


What about the second question? It seems like there is nothing I can do to change where the binary is built at.


For this set CMAKE_RUNTIME_OUTPUT_DIRECTORY in CMakeListst.txt or directly in CMakeCache (you can also check the discussion here:


For building libraries use:


For executables use:


The absolute path is necessary, because relative paths are relative to the build directory and not your project directory.


Please sign in to leave a comment.