ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

CMake​Builder

by rwols ST3 OS XLinux

Configure and build a CMake project right from within Sublime Text 3.

Details

Installs

  • Total 169
  • Win 2
  • OS X 59
  • Linux 108
Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9
Windows 0 0 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 0 0 2 2 1 0 0 1 0 3 3 3 2 0 1 0 1 0 0 0 0 1 0 1 1 1 1 2 1 1 3 1 2 1 2 1 3 2 5 0 1 0 2 2 1 1
Linux 1 2 2 1 2 1 1 3 2 1 1 5 1 1 3 5 6 0 3 4 4 3 1 1 1 0 3 6 4 1 3 0 4 3 1 2 0 1 3 1 2 4 3 5 4 0

Readme

Source
raw.​githubusercontent.​com

CMakeBuilder

Configure and build a CMake project right from within Sublime Text 3.

Instruction Manual

Have a .sublime-project file in your project folder. In that file, create a new dictionary called cmake, as in the following screenshot.

The CMake dictionary item

The cmake dictionary accepts the following keys:

build_folder

The folder where to build the project. If this key is not present in the cmake dictionary, then a temporary folder will be created, and the value of build_folder will be set to that temporary folder. You can always browse the build folder by running the command

CMakeBuilder: Browse Build Folder ...

root_folder (optional)

The folder where the root CMakeLists.txt file resides. If this is not specified, it is assumed that the root folder is the same as the project folder. This setting can be useful if your project is “embedded” into a larger project.

command_line_overrides (optional)

A dictionary of key-value pairs that are passed to the cmake invocation as -D options.

generator (optional)

The generator, passed to the cmake invocation via -G. Currently, only Unix Makefiles and Ninja are supported.

filter_targets (optional)

A list of strings specifying which targets to filter from the list of all targets that may be built. If you have a lot of targets defined, this may be helpful.

Once the sublime project file is populated with the desired cmake settings, you can invoke the command

CMakeBuilder: Configure

from the Command Palette. This will configure the project in the specified builder_folder, and if specified, with the CMakeLists.txt file in root_folder, otherwise the current project path is assumed to have a CMakeLists.txt file.

The CMake dictionary item

Once the project is successfully configured, you can optionally fill your sublime project file with a custom build system derived from the targets generated by cmake. To do this, simply run the command

CMakeBuilder: Write Build Targets to Sublime Project File

from the Command Palette.

The CMake dictionary item

The CMake dictionary item

Now you can enjoy building the correct targets right from Sublime Text 3.

The CMake dictionary item

To force CMake files re-generation run

CMakeBuilder: Clear Cache

and then run

CMakeBuilder: Configure

List of valid variable substitutions

  • packages
  • platform
  • file
  • file_path
  • file_name
  • file_base_name
  • file_extension
  • folder
  • project
  • project_path
  • project_name
  • project_base_name
  • project_extension