Search code examples
c++cmakeclion

How to generate CMakeLists.txt in Clion when I create project from existing sources?


Idk how to make it automaticly - the only option is to specify where the file is - not to generate it, but I don't wan't to write it by my own, because there are too many source files to include.


Solution

  • Here are the steps that helped me:

    1. (Optional) If you have a CMakeLists.txt file in your project already but it's incomplete, delete it first.
    2. Click on Tools > CMake > Unload CMake Project.
    3. Open a source file, you will be presented with the option of selecting an existing CMakeLists.txt file or creating a new one.
    4. Select create new. You will be presented with a list of files in your project which you can select/deselect for inclusion.