I'm trying to convert several big makefile-based applications to CMake to use CLion on them.
Every time I open the project, however, CLion takes about a quarter of an hour to load the CMake project, while the memory indicator stays below "750 of 1987MB". I admit that I'm a CMake newbie, so I guess my CMakeLists.txt files are not optimal.
Basically every application has some specific source code in a directory of its own and is using a couple of 'common' libraries. I have made a structurally equivalent project for sharing on github:
https://github.com/pe-st/zalophus/tree/master/tree
In that project there is an application 'a' and two common librairies 'atlas' and 'greeting'. Every library contains a folder 'test' with Googletest tests.
+ common
| + atlas
| | + test
| + greeting
| + test
+ a
In reality there are about a dozen libraries below common with about 1500 .cpp and .hpp files in total, all of them using Boost and the standard library, nothing else.
The master branch of the project on github contains my first attempt, where all directories are referenced using 'add_subdirectory'. The second attempt (in the with_ext branch) is using ExternalProject_Add for the dependent libraries. When I compile/run the tests from 'greeting' it correctly compiles also the dependency 'atlas'. However it also tries to compile/run the tests of 'atlas' (which fails...) and I couldn't work out how to just compile 'atlas' without the tests.
So how should I better design the CMake project to work with a source code base as shown?
(Note: I have asked the same question also in the Jetbrains CLion forum: https://intellij-support.jetbrains.com/hc/en-us/community/posts/207559245-Large-CMake-Project-loading-is-slow-in-CLion-)