Customisations
Let's have a look at some of the ways you can configure your project, if it does not have a default setup such as in the example above.
Custom target nameβ
First you might want to customize the name of the executable of your project. To do this you can
add a clang-build.toml
file to your project.
my_project
βββ include
| βββ cool_features.hpp
| βββ math_lib.hpp
βββ src
| βββ cool_features.cpp
| βββ my_app.cpp
βββ clang-build.toml
The toml
file looks as follows:
[myexe]
output_name = "MyNextApp-v1.0"
Here the square brackets define a target. Since only the output_name
is given, clang-build continues
to assume that a default project is inside this folder, with the default folder names. This is of course
the case in the example above sou you can simply call:
clang-build
and your project get's compiled.
Custom folder namesβ
While it is common to have a folder structure like the one above, maybe for some reason
the folders are called differently in your project. While automatic detection now does not
work, you can just specify the folder names in your toml
-file.
my_project
βββ header_files
| βββ cool_features.hpp
| βββ math_lib.hpp
βββ external_header_files
| βββ collaborator1_interface.hpp
| βββ collaborator2_interface.hpp
βββ sauce
| βββ cool_features.cpp
| βββ my_app.cpp
βββ clang-build.toml
The toml
file now looks as follows:
[myexe]
output_name = "MyNextApp-v1.0"
include_directories = ["header_files", "external_header_files"]
sources = ["sauce/*.cpp"]
Compiling a libraryβ
If you want to compile a library instead of an executable, you can simply change the target type in the toml file:
[mylib]
output_name = "MyNextLibrary-v1.0"
target_type = "shared library"
[mylib-static]
output_name = "MyNextLibrary-static-v1.0"
target_type = "static library"