CLion - 更改默认构建目录

CLion  - 更改默认构建目录

问题描述:

我通过CLion更改构建目录时遇到问题。我试过:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORYbin)但它似乎没有改变,保持不变( / home / adil / .clion10 / system / cmake / generated / c05c962b / c05c962b / Debug / Project )。

我也尝试了指定的解决方法在这里,但这似乎不起作用。

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?

您需要在 bin 前添加当前您可以使用 $ {CMAKE_CURRENT_SOURCE_DIR}

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.