[cmake-developers] Sublime Text 2 / SublimeClang Generator

Morné Chamberlain thefreeman.za at gmail.com
Fri Oct 12 03:49:14 EDT 2012

On 12 October 2012 07:54, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2012/10/12 Morne' Chamberlain <thefreeman.za at gmail.com>:
>> Hi
>> My name is Morné Chamberlain and this is my first post to this list. I
>> recently started using Sublime Text 2 as a text editor and light development
>> environment.
> Is "light development environment" a tool or is the name you use when
> using Sublime Text as a kind of IDE?

It is just the name I use when using Sublime Text as a kind of IDE yes.

>> I use CMake in many of my projects and felt the need for a
>> Sublime Text 2 project file generator for CMake. So a couple of days ago I
>> started to implement a generator, based initially of off the CodeBlocks one.
>> Current status:
>> - All source and CMakeLists.txt files are included in the generated project
>> file, with the directory tree structure.
>> - For each target a separate build_system entry is created in the
>> sublime-project file, allowing one to build everything or only a specific
>> target if desired.
>> - The build systems invoke the platform specific make command on the
>> generated Makefiles.
>> - Builds from within Sublime Text 2 with Ctrl-B.
>> - The generated project file also includes a sublimeclang_options section
>> where include paths and compiler definitions are defined for use by the
>> SublimeClang plugin (C/C++ as you type syntax and error checking plugin for
>> Sublime Text that uses llvm and clang).
>> Issues:
>> - Sublime Text and SublimeClang do not currently allow you to specify
>> include paths and compiler definitions for SublimeClang per target (or build
>> system), only for the entire project. Currently all include directories and
>> compiler definitions are included for the entire project. This won't affect
>> building the project with Ctrl-B in Sublime Text, but it could lead to
>> incorrect behaviour by SublimeClang.
>> - Currently only tested on Ubuntu 12.04 with Unix Makefiles.
>> If this is something that the CMake community would be interested in then I
>> would like to contribute it to CMake.
> Speaking for myself I really don't know I'll try sublime text 2, even
> if the license
> makes me think I may not use it for a long time.
> Nevertheless why don't you provide us with your patch?
> That way we could at least try it?

Sure, I can do that tonight or over the course of the weekend. What is
the preferred way for me to provide you with the patch? Can I just
send it as an attachment to this list, or should I send it somewhere
specific? I could also put it on Github if that would be convenient?

> I'm not a Sublime Text user so I don't even know how to create a
> Sublime Text project in the first place.
> On my first try I saw that syntax highlighting for CMake files are not included
> in Sublime Text, is this part of your contribution as well?

Sublime Text is very plug-in centric. There is a plug-in available
that provides CMake syntax highlighting support. The easiest way to
get started with plug-ins is to install the Package Control plug-in
from here: http://wbond.net/sublime_packages/package_control.
Pacakge Control manages a repository of available plug-ins and can
list, install and remove plug-ins for you. I use the SublimeClang
plug-in to provide code completion and some static error analysis for
C/C++ code. To get all of the SublimeClang functionality it needs llvm
and clang installed on your system, but it comes with a CMake based
build set up that can download and compile this for you if you don't
have it. I'll admit that it maybe isn't very desirable to have to
install a lot of plug-ins to get all this functionality, but I've
found that once this is all set up it works really well.

> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org

More information about the cmake-developers mailing list