CMake Editors Support: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Remove leading space rectangles from preformatted blocks)
Line 1: Line 1:
==CMake Editor Modes==
==CMake Editor Modes==

There are [[CMake]] syntax highlighting and indentation supports for many editors:
There are CMake syntax highlighting and indentation supports for many editors:

* '''[ Eclipse]''' There are two plugins for Eclipse:
* '''[ Eclipse]''' There are two plugins for Eclipse:

Revision as of 18:24, 25 April 2018

CMake Editor Modes

There are CMake syntax highlighting and indentation supports for many editors:

  • Eclipse There are two plugins for Eclipse:
    • The CMakeEd plugin for Eclipse provides syntax coloring and content assist for editing CMakeLists.txt and any file ending in a .cmake extension. It also integrates the CMake command reference documentation into the Eclipse Help system. This plugin does NOT do project management for you or generate CMake files for you. You are still responsible for this part. CMakeEd just makes writing the CMakeLists.txt files easier. Unfortunately, the built-in documentation has not been updated for several years and is badly out of date.
    • The cmake4eclipse plugin generates the build scripts when you build the project from eclipse -- no need to manually invoke cmake with the CDT generator. It does not provide project management, your CMakeLists.txt files control the build. The plugin comes with a Language Settings Provider that feeds (non standard) include paths and pre-processor symbols defined in your CMake scripts to the CDT-Indexer.
    • The CMakeBuilder plugin provides a user friendly interface to easily manage CMake-based projects, with the following features: advanced parser, Advanced CMake outline, CMakeBuilder perspective, symbol table and environment inspector, CMake files editor with syntax highlighting, code assist, wizard-oriented project management, Project Nature CMakeBuilder for CDT projects, and incremental project builders.
      As of 2017, this seems to be dead: No downloads page, apparently no downloads in the past year.
    • More plugins can be found in the Eclipse Marketplace.
  • Eclipse C/C++ Development Tooling (CDT) 9.2.0 claims to provide an experimental CMake feature.
    • Here you find documentation how to use the Eclipse CDT project generator of CMake.
    • Here you find documentation how to use Eclipse with the regular Makefile generator of CMake (for versions < 2.6 of CMake).
  • KDevelop 4 supports CMake-based projects natively.
  • CLion, though not free, uses CMake-based projects natively.
  • Enscript syntax highlighting rules. To enable it:
    1. copy in the hl/ directory.
    2. add the following in the namerules section of the hl/ file:
/CMakeLists\.txt/               cmake;
/\.cmake.*$/                    cmake;
/\.ctest.*$/                    cmake;
  • Epsilon has a CMake extension that supports syntax highlighting, indentation, and auto-completion of expressions for control statements such as if-else-endif, foreach-endforeach, and while-endwhile.
  • Kate, KWrite, KDevelop and all other KDE applications, which use the kate text-editing component support cmake syntax highlighting since KDE 3.4.
  • SciTE version 1.73 has CMake support. To enable the feature edit SciTEGlobal.Properties and remove the comment before the CMake lines.
  • Sublime Text Sublime Text is a sophisticated text editor for code, markup and prose. You'll love the slick user interface, extraordinary features and amazing performance. CMake synatx support is provided through the Package Control and the CMake Package.
  • TextMate is a wonderful text editor for OS X. CMake Bundle. This plugin adds syntax highlighting for CMake files and rudimentary completion for command, properties and cmake variables.
  • VIM syntax highlighting and indentation mode. To enable indentation, copy indentation file to your .vim/indent directory, syntax highlighting file to your .vim/syntax directory and add the following to your .vimrc:
:autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,* runtime! indent/cmake.vim 
:autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,* setf cmake
:autocmd BufRead,BufNewFile *.ctest,* setf cmake
  • Visual Studio 2010 Professional and above have two extensions available for editing CMake files. Vissemee provides syntax highlighting for CMake. CMake Tools for Visual Studio provides both syntax highlighting and IntelliSense for CMake.

Creating New Editor Mode

The best way to start is to check the logic in existing ones. Make sure to enable indentation for files that match the following file names:

  • CMakeLists.txt
  • *.cmake
  • *
  • *.ctest
  • *

CMake: [Welcome | Site Map]