Issue: my project does not use cmake, instead I create a "fake" CmakeLists.txt file which contains all headers but no build targets. This works amazingly, CLion parses all code and all headers correctly. However I also want to debug my apps.
So far I found two solutions:
1) Create external tool in "Settings -> Tools -> External Tools". In run configuration add "Before Launch" -> "Run external tool" and select that external tool.
External tool needs to know what to build, so I put: Working Directory = $FileDir$
This works almost ideally. Two issues: 1) gcc errors on console are unclickable, you cannot click to navigate to that file:line. 2) you need to open some file of that directory in editor. If you editor is now in other dir and you hit "debug" - it will try to build wrong dir.
2) Create "Custom Build Target". This menu is extremely hidden, jetbrains want to make our life hard :(
It is in: "Tools -> Build -> Custom Build Target -> Plus sign to create new target -> Click triple dot menu -> Plus sign"
(note: if you need to modify it -- you need to do all those 6 clicks again)
This allows you to enter custom command, e.g. "make". But this tool ignores "$FileDir$" variable. So your "make" program will always run in home dir (or the dir where CLion was launched from).
You can hard-code path and run make, in such case it works beautifully. And gcc errors are clickable, you can jump to file:line.
So the main issue: you need to do those 6 clicks and you need to create separate target with hard-coded path for all you applications.
Ideally I would love CLion to allow specifying work dir of custom build tool inside Run Configuration.