Different CMake caches per configuration

Is there a way to have different CMake configurations in the same project ? As far as I can tell, the CMake cache is shared between all CLion configurations, so a CLion configuration is just a target + a CMAKE_BUILD_TYPE + some execution parameters. Is there a way to specify configuration-specific CMake arguments? For instance, let's say that I have a CMake option for enabling logging in my project (independently of the CMAKE_BUILD_TYPE), can I define one configuration with logging enabled (-DENABLE_LOGGING=ON) and one with logging disabled (-DENABLE_LOGGING=OFF) so that I can quickly switch between the two?

Having multiple build directories with various configurations seems to me like a standard way of working with CMake, so I hoped CLion would allow me to keep working like that (like QtCreator does, where configurations are associated with a build directory having its own CMake cache). Is there something I missed or is this not possible in CLion?



1 comment
Comment actions Permalink

Hi Luc.

Sorry for the delay. We have a related issue in the tracker already: https://youtrack.jetbrains.com/issue/CPP-3159. Feel free to comment or upvote.


Please sign in to leave a comment.