How to create a CLion project, specifying a separate directory for IDE files than code?

已回答

I want my IDE project files here:

c:\dev\ide\<prj_name>\clion\.idea\

And my code here:
C:\dev\<prj_name>\

How do I do this with CLion?

I can do this with every other IDE from JetBrains, except CLion.

I have a specific reason for doing this.

0

Answered via email, but I duplicate the answer here too:

Currently, there is no officially supported way of doing so, however, a workaround exists:

  • Create an empty CMakeLists.txt file at c:\home\dev\ide\<prj_name>\clion\
  • In CLion, open this file as a project (File | Open)
  • Execute Tools | CMake | Change Project root, point to c:\home\dev\ide\<prj_name>
  • Remove the created CMakeLists.txt afterwards
  • If the project is not properly loaded after that, right-click on your actual CMakeLists.file, and choose Load CMake project
0

请先登录再写评论。