I'm trying to use CLion (latest version - 2019.3) to work on a source repository of mine, which already uses CMake (i.e. has a CMakeLists.txt
). Now, the package has some options regarding which targets to build; by default it builds just a few, but if you set an option to ON
, then a bunch of tests are compiled and built.
Unfortunately, I don't quite see where CLion lets you set CMake option values for the build subdirectories it generates. Is it really forcing the defaults on you, or am I missing something in the main UI or the preferences?
CMake now supports setting (cached) option values:
For now, there's no UI for setting option values. You'll need to edit your CMake profiles (on the menu: File | Settings | Build, Execution, Deployment | CMake) and manually add CMake command-line options, e.g. -DBUILD_TESTS:BOOL=ON
.
I've filed bug CPP-20268 about this fact.
CLion developers are planning to allow this through a mechanism for editing all of the CMake cache - an approach which I disapprove of, but it'll be better than nothing I suppose. That is issue CPP-423.