In general, IDEs are already supported by a standard CMake project. There are just a few extra things that can help IDEs perform even better.
Some IDEs, like Xcode, support folders. You have to manually enable the
USE_FOLDERS global property to allow CMake to organize your files by folders:
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Then, you can add targets to folders when after you create them:
set_property(TARGET MyFile PROPERTY FOLDER "Scripts")
Folders can be nested with
/. You can control how files show up in each folder with regular expressions or explicit listings in
source_group("Source Files" REGULAR_EXPRESSION ".*\\.c[ucp]p?")
Take a look at this blog post for tips on ways to automatically sort folders to match your source code layout.
Running with an IDE
To use an IDE, either pass `-G"name of IDE" if CMake can produce that IDE's files (like Xcode, Visual Studio), or open the CMakeLists.txt file from your IDE if that IDE has built in support for CMake (CLion, QtCreator, many others).