ModernCMake-Chinese
  • Introduction
  • Modern CMake 简介
    • 安装 CMake
    • 运行 CMake
    • Do's and Don'ts
    • CMake 中的新变化
  • 基础知识简介
    • 变量和 Cache
    • 在CMake 中编程
    • 与你的代码交互
    • 如何结构化你的工程
    • 运行其他程序
  • Adding Features
    • C++11 and Beyond
    • Small but common needs
    • Utilities
    • Useful modules
    • IDEs
    • Debugging
  • Including Projects
    • Submodule
    • DownloadProject
    • Fetch (CMake 3.11)
  • Testing
    • GoogleTest
    • Catch
  • Exporting and Installing
    • Installing
    • Exporting
    • Packaging
  • Looking for libraries
    • CUDA
    • OpenMP
    • Boost
    • MPI
    • ROOT
      • UseFile Example
      • Simple Example
      • Simple Example CMake 3.11+
      • Dictionary Example
    • Minuit2
Powered by GitBook
On this page
  • Folders
  • Running with an IDE

Was this helpful?

  1. Adding Features

IDEs

PreviousUseful modulesNextDebugging

Last updated 6 years ago

Was this helpful?

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 Files" REGULAR_EXPRESSION ".*\\.c[ucp]p?")

Take a look at 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).

source_group
this blog post