CMake Editors Support: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(add notepad++ to list of editors with cmake support)
Line 3: Line 3:
There are [[CMake]] syntax highlighting and indentation supports for several editors:
There are [[CMake]] syntax highlighting and indentation supports for several editors:


* Emacs [http://www.cmake.org/CMakeDocs/cmake-mode.el combined syntax highlighting and indentation mode].  The current file in the repository doesn't behave very well if you try to run fill-paragrap (M-q) on comments.  This [[CMake Emacs mode patch for comment formatting|patched version]] written by Miguell A. Figueroa-Villanueva fixes it.  Hopefully the patch will make it into the tree someday. To enable it, add the following to your ''.emacs'' file:
* '''Emacs''' [http://www.cmake.org/CMakeDocs/cmake-mode.el combined syntax highlighting and indentation mode].  The current file in the repository doesn't behave very well if you try to run fill-paragrap (M-q) on comments.  This [[CMake Emacs mode patch for comment formatting|patched version]] written by Miguell A. Figueroa-Villanueva fixes it.  Hopefully the patch will make it into the tree someday. To enable it, add the following to your ''.emacs'' file:


<pre>
<pre>
Line 16: Line 16:
</pre>
</pre>


* 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:
* '''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:


<pre>
<pre>
Line 24: Line 24:
</pre>
</pre>


* 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.
* '''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 since KDE 3.4.
* '''[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 since KDE 3.4.


* UltraEdit (an approach) save the jpg as text: [[Image:wordfile.jpg]]
* '''UltraEdit''', save the jpg as text: [[Image:wordfile.jpg]]


* Enscript [http://tristancarel.com/pub/patches/enscript/cmake.st syntax highlighting rules]. To enable it:
* '''Enscript''' [http://tristancarel.com/pub/patches/enscript/cmake.st syntax highlighting rules]. To enable it:
*# copy <tt>cmake.st</tt> in the <tt>hl/</tt> directory.
*# 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:
*#add the following in the <tt>namerules</tt> section of the <tt>hl/enscript.st</tt> file:
Line 40: Line 40:
</pre>
</pre>


* [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.
* '''NEdit''' support was added by [http://public.kitware.com/pipermail/cmake/2007-May/014267.html Philippe Poilbarbe]


* [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.
* '''[http://notepad-plus.sourceforge.net/uk/site.htm Notepad++]''' added CMake support in version 4.1


* NEdit support was added by [http://public.kitware.com/pipermail/cmake/2007-May/014267.html Philippe Poilbarbe]
* '''[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 the CMake lines.


* [http://notepad-plus.sourceforge.net/uk/site.htm Notepad++] added CMake support in version 4.1
* '''[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.


==Creating New Editor Mode==
==Creating New Editor Mode==

Revision as of 19:56, 29 October 2007

CMake Editor Modes

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

  • Emacs combined syntax highlighting and indentation mode. The current file in the repository doesn't behave very well if you try to run fill-paragrap (M-q) on comments. This patched version written by Miguell A. Figueroa-Villanueva fixes it. Hopefully the patch will make it into the tree someday. To enable it, add the following to your .emacs file:
; Add cmake listfile names to the mode list.
(setq auto-mode-alist
	  (append
	   '(("CMakeLists\\.txt\\'" . cmake-mode))
	   '(("\\.cmake\\'" . cmake-mode))
	   auto-mode-alist))

(autoload 'cmake-mode "~/CMake/Docs/cmake-mode.el" t)
  • 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,*.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 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.
  • Kate, KWrite, KDevelop and all other KDE applications, which use the kate text-editing component support cmake syntax highlighting since KDE 3.4.
  • Enscript syntax highlighting rules. To enable it:
    1. copy cmake.st in the hl/ directory.
    2. add the following in the namerules section of the hl/enscript.st file:
  /CMakeLists\.txt/               cmake;
  /\.cmake.*$/                    cmake;
  /\.ctest.*$/                    cmake;
  • SciTE version 1.73 has CMake support. To enable the feature edit SciTEGlobal.Properties and remove the comment before the CMake lines.
  • TextMate is a wonderful text editor for OS X. CMake Bundle. This plugin adds syntax highlighting for CMake files.

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