[Cmake] (X)Emacs mode
Peter Vanroose
Peter.Vanroose at esat.kuleuven.ac.be
Tue Apr 29 11:50:41 EDT 2003
And here is a CMake syntax file for use with vim.
Usage: place in your $VIMRUNTIME/syntax directory and add the following
line to your syntax.vim :
au BufNewFile,BufRead CMakeLists.txt so $VIM/syntax/cmake.vim
-- Peter Vanroose.
-------------- next part --------------
" Vim syntax file
" Language: CMake
" Author: Peter Vanroose
" Last Change: 29 April 2003
" Remove any old syntax stuff hanging around
syn clear
" some directives
syn match cmakePreCondit "\(^\s*\(IF\|ELSE\|ENDIF\|FOREACH\|ENDFOREACH\|MACRO\|ENDMACRO\)\|\<\(NOT\|EXISTS\|COMMAND\|MATCHES\|LESS\|GREATER\|STRLESS\|STRGREATER\)\)\>"
syn match cmakeInclude "^\s*INCLUDE"
" cmake targets
syn match cmakeTarget "^\s*\(LIBRARY\|SUBDIRS\|MESSAGE\|PROJECT\|OPTION\)\>"
syn match cmakeStatement "^\s*\(ADD_CUSTOM_COMMAND\|ADD_DEFINITIONS\|ADD_DEPENDENCIES\|ADD_EXECUTABLE\|ADD_LIBRARY\|ADD_TEST\|BUILD_COMMAND\|BUILD_NAME\|FIND_FILE\|FIND_LIBRARY\|FIND_PATH\|FIND_PROGRAM\|INCLUDE_DIRECTORIES\|INCLUDE_EXTERNAL_MSPROJECT\|INCLUDE_REGULAR_EXPRESSION\|INSTALL_FILES\|INSTALL_PROGRAMS\|INSTALL_TARGETS\|LINK_DIRECTORIES\|LINK_LIBRARIES\|LOAD_CACHE\|MAKE_DIRECTORY\|MARK_AS_ADVANCED\|OUTPUT_REQUIRED_FILES\|SET\|WRAP_EXCLUDE_FILES\|EXCLUDE\|SET_SOURCE_FILES_PROPERTIES\|WRITE_FILE\)\>"
syn match cmakeSpecial "^\s*\(ABSTRACT_FILES\|AUX_SOURCE_DIRECTORY\|CABLE_CLASS_SET\|CABLE_WRAP_TCL\|CONFIGURE_FILE\|CONFIGURE_GCCXML\|ENABLE_TESTING\|FLTK_WRAP_UI\|GET_FILENAME_COMPONENT\|QT_WRAP_CPP\|QT_WRAP_UI\|SITE_NAME\|SOURCE_FILES\|SOURCE_FILES_REMOVE\|SOURCE_GROUP\|SUBDIR_DEPENDS\|TARGET_LINK_LIBRARIES\|USE_MANGLED_MESA\|UTILITY_SOURCE\|VARIABLE_REQUIRES\|VTK_WRAP_JAVA\|VTK_WRAP_PYTHON\|VTK_WRAP_TCL\)\>"
" identifiers
syn match cmakeIdent "\$([^)]*)" contains=cmakeStatement
syn match cmakeIdent "\${[^}]*}"
syn match cmakeIdent "\<\(CACHE\|PATH\|STATIC\|COPYONLY\|OPTIONAL\|YES\|NO\|BEFORE\|ADVANCED\|COMPILE_FLAGS\|COPYONLY\|ESCAPE_QUOTES\|IMMEDIATE\|@ONLY\)\>"
" Errors
syn region cmakeIgnore start="\\$" end="^." end="^$" contains=ALLBUT,cmakeError
" Comment
syn match cmakeComment "^\s*#.*$"
syn region cmakeDString start=+"+ skip=+\\"+ end=+"+ contains=cmakeIdent
syn region cmakeSString start=+'+ skip=+\\'+ end=+'+ contains=cmakeIdent
syn region cmakeBString start=+`+ skip=+\\`+ end=+`+ contains=cmakeIdent,cmakeSString,cmakeDString,cmakeNextLine
if !exists("did_cmakefile_syntax_inits")
let did_cmakefile_syntax_inits = 1
hi link cmakeNextLine cmakeSpecial
hi link cmakeSpecTarget Statement
hi link cmakeTarget Function
hi link cmakeInclude Include
hi link cmakePreCondit PreCondit
hi link cmakeStatement Statement
hi link cmakeIdent Identifier
hi link cmakeSpecial Special
hi link cmakeComment Comment
hi link cmakeDString String
hi link cmakeSString String
hi link cmakeBString Function
hi link cmakeError Error
endif
let b:current_syntax = "cmake"
More information about the CMake
mailing list