About Ctor

Welcome to the official ctor.cc C++ build system website!

Have you ever wondered, why, when you are a C++ programmer and you want to compile a C++ project, you also need to learn some other language (such as make, cmake, lua, python, m4, …) in order to be able to build your project?

Well, wonder no more - ctor is here!

“'ctor” is an often used short-hand form of the word “constructor” referring to the class function that sets up the internals of an object in object oriented programming - so the intended pronunciation of “ctor” is constructor but sometimes also referred to as see-tor.

Ctor is a C++ based build system, making it possible to configure and build complex projects without writing a single line of non-C++.

It aims towards the feature-richness found in auto-tools and beyond, but with a compilation speed rivalling that of raw makefiles.

And the only dependency is a functioning C++ compiler!

Get it


git clone --recursive git://git.ctor.cc/ctor.git libctor

Browse the sources: http://cgit.ctor.cc/ctor.git/


Ctor is distributed under the BSD 2-Clause License. See accompanying file LICENSE for details.

Getting started

If the ctor library is already available as part of your distro skip directly to “How to set up your build configuration”.

Adding libctor to your project

Assuming you are working on a git repository:

git submodule add git://git.ctor.cc/ctor.git libctor
git submodule update --init --recursive

This should give you all the files you need to build your code. Enter the libctor dir and run the ./boostrap.sh script, which will build the ctor binary. Then run ./ctor to build it - it will end up in the build subfolder.

How to set up your build configuration

Assuming that you have a project with a two C++ source files, hello.cc and world.cc, and would like to compile them into an application binary (target) with the name hello:

In the root of your project you can create your first ctor.cc build configuration file:

#include <libctor.h>
BuildConfigurations myConfigs()
        .target = "hello",  // output filename
        .sources = { "hello.cc", "world.cc" }, // list of source files to compile
        // See libctor.h for more options
// Register callback

Now you just need to compile the ctor.cc file along with the libctor.a library:

g++ -std=c++20 ctor.cc -Llibctor/build -lctor -Ilibctor/src -pthread -o ctor

Finally the configure step must be carried out to set (at least) the include and lib paths to ctor (this step can be skipped if ctor is installed in the system paths such as /usr/include and /usr/lib):

./ctor configure --ctor-includedir=libctor/src --ctor-libdir=libctor/build

One can advantageously put these commands into a boostrap.sh script for the project. It will only be needed the first time ctor is being built.

Finally, run ./ctor to build your project.

Getting Help

To get help log on to libera.chat on the #ctor channel.