1
0
mirror of synced 2024-11-05 12:38:54 +01:00
modern-cmake/chapters/features/ides.md
Henry Fredrick Schreiner d2c2c1b78d Cleanup, extra CUDA info
2018-04-02 17:39:08 +02:00

1.3 KiB

Supporting IDEs

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.

Folders

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_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).