build output/.idea folder


I have a couple questions:
1) is it possible set build output path directly in CMakeLists.txt (right now I (have to?) do this in build settings)
2) is it possible to open/import project directly from CMakeLists? Point is I don't want to include .idea folder in my git repo (if possible).
3) is it possible to have one workspace with several projects?


Comment actions Permalink

1) Yes. Just setup standard cmake variables, and clear CLion output setting.

2) You can have .idea folder outside of your project and thus outside of git.

3) No, and this is one of main thing why I cannot start using CLion. Please vote for

Comment actions Permalink

regarding 3), would creating an aggregating CMakeLists.txt be a reasonable workaround for you?

Comment actions Permalink

First, thanks for the replies. I think I tried 1) but IIRC it didn't work for me, will try again.
As for aggregate CMakeLists: I'm new to CMake, how to do that? I'll try to google a bit.
If I can add dependencies (assuming in correct order) then that would be fine as long
as I could see and edit source files in project treeview. Is this possible?


EDIT: just tried to use


instead of settings/CMake/Build output path but it doesn't work. Being able to override output path for libraries/executables is quite important to me.
Am I doing something wrong?
(aggregate CMakeLists seem to work fine)
*sigh*, CMAKE_ARCHIVE_OUTPUT_DIRECTORY almost works. But $<CONFIG> gets expanded to $$<CONFIG>.
$<CONFIG> works fine in target_link_libraries though...

Comment actions Permalink

> EDIT: just tried to use


> instead  of settings/CMake/Build output path but it doesn't work. Being able to  override output path for libraries/executables is quite important

It works fine to me, but I am setting absolute path:
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY /home/me/lalala/lib)

I suggest for you to debug it with:
  message(FATAL_ERROR "$<CONFIG>")
  message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/../BuildOutput/.clion/$<CONFIG>")

Comment actions Permalink

Thanks, actually what worked for me was using CMAKE_ARCHIVE_OUTPUT_DIRECTORY. Maybe that's different on Linux (I'm using Win).
So now I stick with aggregate CMakeLists (not that bad) and to set build output path in settings (once for each aggregate lists).
I realized though that I cannot use generators within CMAKE_xxx_OUTPUT_DIRECTORY, but this is a CMake feature,
not a CLion problem. I guess I will close the answer, accepting your original suggestion.

So far I think CLion has potential. It needs a better C++ parser, but this can wait. There are more important things to work on.
And if JetBrains manages to reduce memory usage to 50%, that would be awesome. But I doubt it's possible.
For comparison, it uses 12 times as much memory as QtCreator for a project of similar scale...

Anyway thanks again!


Please sign in to leave a comment.