Difference between revisions of "CMake Editors Support"

From KitwarePublic
Jump to navigationJump to search
(Replace content with link to new CMake community wiki)
(46 intermediate revisions by 19 users not shown)
Line 1: Line 1:
==CMake Editor Modes==

There are [[CMake]] syntax highlighting and indentation supports for several editors:
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/Editors here].
* Emacs [http://www.cmake.org/CMakeDocs/cmake-mode.el combined syntax highlighting and indentation mode]. To enable it, add the following to your ''.emacs'' file:
; Add cmake listfile names to the mode list.
(setq auto-mode-alist
  '(("CMakeLists\\.txt\\'" . cmake-mode))
  '(("\\.cmake\\'" . cmake-mode))
(autoload 'cmake-mode "~/CMake/Docs/cmake-mode.el" t)
* VIM [http://www.cmake.org/CMakeDocs/cmake-syntax.vim syntax highlighting] and [http://www.cmake.org/CMakeDocs/cmake-indent.vim 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,*.cmake.in runtime! indent/cmake.vim
:autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in setf cmake
:autocmd BufRead,BufNewFile *.ctest,*.ctest.in setf cmake
* Eclipse [http://www.cthing.com/CMakeEd.asp CMake Editor]. Plug-in for the Eclipse IDE providing syntax coloring and content assist for editing CMakeLists.txt and any file ending in a .cmake extension. Integrates the CMake command reference documentation into the Eclipse Help system.
* [http://kate.kde.org Kate], KWrite, [http://www.kdevelop.org KDevelop] and all other [http://www.kde.org KDE] applications, which use the kate text-editing component support cmake syntax highlighting. Currently you have to open the settings dialog and choose download (Settings -> Configure Kate -> Editor -> Highlighting -> Download) and there select CMake in the listbox. Then the cmake syntax highlighting definition file for kate will be downloaded and installed. From KDE 3.4 and later cmake syntax highlighting will come with standard KDE.
* UltraEdit (an approach) save the jpg as text: [[Image:wordfile.jpg]]
* Enscript [http://tristan-carel.com/pub/patches/enscript/cmake.st syntax highlighting rules]. To enable it:
*# copy <tt>cmake.st</tt> in the <tt>hl/</tt> directory.
*#add the following in the <tt>namerules</tt> section of the <tt>hl/enscript.st</tt> file:
  /CMakeLists\.txt/              cmake;
  /\.cmake.*$/                    cmake;
  /\.ctest.*$/                    cmake;
* [http://scintilla.sourceforge.net/SciTEDownload.html SciTE] version 1.73 has CMake support. To enable the feature edit SciTEGlobal.Properties and remove the comment before cmake lines.
* [http://www.macromates.com TextMate] is a wonderful text editor for OS X. [http://www.bluequartz.net/CMake.tmbundle.zip CMake Bundle]. This plugin adds syntax highlighting for Cmake files.
* NEdit support was added by [http://public.kitware.com/pipermail/cmake/2007-May/014267.html Philippe Poilbarbe]
==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
* *.cmake.in
* *.ctest
* *.ctest.in

Latest revision as of 15:41, 30 April 2018

The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.