I'm having some performance issues with my cmake project in CLion. In my cmake files we are using glob (and maybe glob_recurse, not sure) to avoid having to add files to the cmake files all the time.
This practice is not recommended by CMake and I understand that the reason is that if you add a file and rely on glob to pick it up then cmake doesn't actually know that a dependency changed because the cmake file didn't change because you didn't actually add the file name to cmake file. And that's why I have to reload the CMake files when using CLion.
CLion supports adding files to the build dependency, and this solves the problem when not using glob. The user gets a dialog offering to add that file to one or more cmake files. The cmake file gets the source file added thereby touching the cmake file and the build dependency works. There is no need to reload the entire cmake hierarchy. And I'll have to guess that CLion can take advantage of this and not rebuild the entirety of the indices, only modify the parts that changed.
Here's the idea though. If the dialog that offers to add the file to the source dependencies in the cmake files would offer to just touch the files instead then we get the same effect, I believe. Or even just silently touching them. I've tried this method by opening the cmake file in question and just making a cosmetic change and saving it to "touch it". It appears to work. A full reload is no longer necessary.
From a CLion perspective this could be really cool because cmake files using glob would work better in CLion than outside CLion. The recommendation from the cmake guys to not use glob won't change. It just won't apply to CLion users anymore so CLion users will be an exception. And that could make the CLion/CMake combination the most elegantly working IDE build system and the standard to beat.