<commit_before># 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](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/1.png "The CMake dictionary inside a sublime project file")

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](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/2.png "Running the Configure step")

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](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/5.png "Configuring the custom build system")

![The CMake dictionary item](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/7.png "The custom build system has been configured")

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

![The CMake dictionary item](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/8.png "Building your defined targets with multithreaded make in Sublime Text 3")

To force CMake files re-generation run

    CMakeBuilder: Clear Cache

and then run

    CMakeBuilder: Configure<commit_msg>Update readme to list all valid variable substitutions.<commit_after># 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](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/1.png "The CMake dictionary inside a sublime project file")

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](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/2.png "Running the Configure step")

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](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/5.png "Configuring the custom build system")

![The CMake dictionary item](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/7.png "The custom build system has been configured")

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

![The CMake dictionary item](https://raw.githubusercontent.com/rwols/CMakeBuilder/screenshots/screenshots/8.png "Building your defined targets with multithreaded make in Sublime Text 3")

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
* machine
* processor
{'fraction_non_alphanumeric': 0.06681339412042132, 'fraction_numerical': 0.0025153277786511556, 'mean_word_length': 4.82067703568161, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '153308', 'n_tokens_mistral': 1760, 'n_tokens_neox': 1677, 'n_words': 804}