How to regenerate cmake files?

Greetings!

CLion on Windows 7/8 saves all generated CMake-Files in c:\Users\<username>\.clion10\system\cmake\generated\.
Is there a way to clean them and regerate?

I use a CMakeLists.txt that also changes CMAKE_MODULE_PATH to include my own "FindGLUT.cmake".
If I make any changes to that file (i.e. swap the order of which module to report back), CLion does not regenerate the CMake Files with consistently fail.

I have to close CLion, delete that folder manually and then restart CLion.


... now I hope there is some convenient GUI way. Because thats not my expectation of a 2015 GUI, especially from JetBrains.
So I just think I am missing some menu item or button or so ;-)


Kind regards,
Viktor

8 comments
Comment actions Permalink

The "Reload Cmake Project" button in CMake toolbar window should do the trick

0
Comment actions Permalink

This will simply re-invoke CMake, but will not remove already existing files. You can use File -> Invalidate Caches menu, but please read the warning before proceeding.

0
Comment actions Permalink

Found the following two possible ways:

  • File => Reload CMake Project
  • View => Tool Window => CMake => Reload CMake Project

None of those regenerate the cmake/generated folder :-(
0
Comment actions Permalink

Yes that works as expected.

But why do I have to restart CLion for this?
Shouldn't i.e. reloading the project suffice?

0
Comment actions Permalink

Because this kills CLion's entire cache directory which, besides CMake files, contains many other things. There is a feature request to implement ability to kill CMake cache only, please upvote.

0
Comment actions Permalink

Seems reasonable, upvoted that feature request.

So for now I have to do that manually.

0
Comment actions Permalink

That's the only way that worked for me - using C-Lion (2018.2+)

 

Assumption:  have directory with C++ sources

Task: need to regenerate CMakeLists.txt  from scratch

Resolution:  go to File -> Import Project 0> coose directory with your sources -> there is a prompt - asking  about which sources to include... and then automated process will create file and content for CMakeLists.txt.

 

Happy coding.

 

0
Comment actions Permalink

@Mbuehl, here is a feature request about regenerating a CMakeLists.txt: https://youtrack.jetbrains.com/issue/CPP-1749. Feel free to comment or upvote.

0

Please sign in to leave a comment.