CMake is the meta-build-system used to compile chigraph. It generates files for another build system (GNU Makefiles, Visual Studio, Ninja, etc) that are used to compile your project.
There are some notable flags you can pass to it to configure how chigraph is compiled.
Basic CMake usage
You usually want to run CMake in a separate directory from the chigraph source directory to make it impossible to check in build files.
build subdirectory is a common choice, and is already in the
Because CMake can target many different build systems, you have to tell it which to target.
On linux and macOS, this is usually
Unix Makefiles or
On windows, it’s usually a Visual Studio generator. You sepcify the generator using the
-G flag on the cmake commandline, or
if you’re using the GUI then it will ask.
You can specify variables to pass to the CMake script with the
-D flag, which is how compile options are set.
cmake .. -G<Generator> [ -D<Variable name>=<Variable value> ]
Important generic CMake flags
Flags that aren’t specific to chigraph but important nonetheless.
CMAKE_BUILD_TYPE: Set this to
Releaseto build in a deubg or release configuration.
CMAKE_CXX_FLAGS: Extra flags to pass to the C++ compiler. Useful for passing sanitizers like
CMAKE_INSTALL_PREFIX: Where to install chigraph to
CMAKE_PREFIX_PATH: Paths to find packages outside of the normal search paths.
LLVM_CONFIG: Path to the
Chigraph specific flags
Flags that are specifc to chigraph. All have
CG_BUILD_TESTS: Set to
OFFif you don’t want the tests built. Defaults to
CG_BUILD_EXAMPLES: Set to
ONif you want the examples to be built. Defaults to
CG_BUILD_DEBUGGER: Set to
OFFif you don’t want the debugger to be built with chigraph. Useful when your LLVM install doesn’t include LLDB. Defaults to
CG_USE_SYSTEM_LIBGIT2: Set to
ONif you want CMake to find a system libgit2 instead of the prepackaged one. Defaults to
CG_USE_SYSTEM_BOOST: Set to
ONif you want CMake to find the system boost install instead of the prepackaged install. Defaults to