Supporting IDEs

    Some IDEs, like Xcode, support folders. You have to manually enable the global property to allow CMake to organize your files by folders:

    Then, you can add targets to folders after you create them:

    You can control how files show up in each folder with regular expressions or explicit listings in source_group:

    You can also control how the folders inside targets appear. There are two ways, both using the «command:source_group» command. The traditional way is

    For the TREE option, you should usually give a full path starting with something like ${CMAKE_CURRENT_SOURCE_DIR}/ (because the command interprets paths relative to the build directory). The prefix tells you where it puts it into the IDE structure, and the FILES option takes a list of files. CMake will strip the path from the FILE_LIST path, it will add PREFIX, and that will be the IDE folder structure.