Note that Jalog requires at least C++17, including for the projects which use it.
Here are several ways by which you can add Jalog to your project. All of them require CMake. Support for other build systems/generators is not planned.
The CMake script defines the target jalog::jalog
which you can add as a link library to your own targets.
The easiest way to add Jalog to a project would be as a CPM.cmake package. If you are using this package manager (and you should be :) ), you only need to add this line to your CMakeLists.txt
: CPMAddPackage(gh:iboB/[email protected])
. Update the version "0.1.0" to the one you want.
Currently this is the only supported way of adding Jalog to a project though you can also add it:
Jalog uses CPM.cmake to handle its own depenendcies. If you add Jalog as a submodule to your repo and add_subdirectory
things will likely still work. Jalog's CMake configuration will run CPM.cmake and fetch the dependencies. However if your project uses any of these dependencies without CPM.cmake there will be a clash of targets and the project likely won't build (or worse yet, it will build but will contain strange bugs due to ODR violations and ABI differences)
The dependencies of the project are
- iboB/[email protected]
- iboB/[email protected]
- iboB/[email protected]
- iboB/[email protected]
- (for building the tests only) iboB/[email protected]
If you provide the targets of the dependencies and only use code/jalog/CMakeLists.txt
things will likely work.
As a whole the build of Jalog is pretty straight-forward, so creating a script for another build system will likely be easy.
Jalog's CMakeLists offers several configuration options:
JALOG_STATIC
- Whether to build a static library. Off by default, leading to a shared library. It's highly recommended to build Jalog as a shared library if there are multiple shared libraries which use Jalog in your project. The build scripts respectICM_STATIC_LIBS
from icm_add_libJALOG_NO_BUILTIN_ASYNC
- Remove support for the built-in async logging features of the library. Note that async logging is still possible with this, but it has to be user-defined.JALOG_BUILD_SINKLIB
- whether to also build the Jalog.Sinklib extension which provides several sinks (CMake targetjalog::sinklib
). On by defaultJALOG_BUILD_TESTS
- whether to also build the Jalog unit tests. Off by defaultJALOG_BUILD_EXAMPLES
- whether to also build the Jalog examples. Off by default