Build and install

Usage as a single header file

Outcome v2 comes in single header file form. This is regenerated per commit. To fetch on Linux:

wget https://github.com/ned14/outcome/raw/master/single-header/outcome.hpp

On BSD:

fetch https://github.com/ned14/outcome/raw/master/single-header/outcome.hpp

If you have curl installed:

curl -O -J -L https://github.com/ned14/outcome/raw/master/single-header/outcome.hpp

Otherwise, simply download the raw file from above and place it wherever it suits you. If you might be debugging using Microsoft Visual Studio, you may find the debugger visualisation file at https://github.com/ned14/outcome/raw/master/include/outcome/outcome.natvis useful to include into your build.

Usage from the Conan package manager

(thanks to Théo Delrieu for contributing this support)

At the command line, add the bintray repo for Outcome to conan:

conan remote add outcome https://api.bintray.com/conan/ned14/Outcome

Now simply add this to your Conan build:

[requires]
Outcome/master@ned14/stable

Outcome will be made available by Conan at <outcome.hpp>.

Usage as a git submodule

If you are very keen on tracking very latest Outcome, you can add it as a git submodule to your project so you can keep abreast of bug fixes. Here is how:

git submodule add https://github.com/ned14/outcome
cd outcome
git checkout master
git submodule update --init --recursive

After this you can bring Outcome into your code using:

#include "outcome/include/outcome.hpp"

That’s it, you are ready to go. From time to time, you may wish to update to latest:

cd outcome
git pull
git submodule update

Usage as a stable source tarball

If you would prefer a single source tarball of the stable branch containing all the documentation, tests and sources, this can always be retrieved from:

https://dedi5.nedprod.com/static/files/outcome-v2.0-source-latest.tar.xz

This tarball is automatically generated when Outcome fully compiles and passes all unit tests on all platforms tested by the CIs. This currently includes:

It should be emphasised that newer compilers are not tested, so there is an unlikely chance that the tarball may not work on a newer compiler.


Running the unit test suite

To run the unit test suite you will need cmake 3.1 or later installed.

mkdir build
cd build
cmake ..
cmake --build .
ctest

On some cmake generators (Visual Studio, Xcode) you may need to tell cmake build a configuration like Release or Debug. Similarly, ctest needs to be told the same e.g.

mkdir build
cd build
cmake ..
cmake --build . --config Release
ctest -C Release

Per commit, tests are run by Travis and uploaded to a CDash dashboard here.


Modular CMake build support

If you are using Outcome in a CMake project, Outcome is a “modular cmake” project using only modern cmake 3 throughout. This lets you add the Outcome directory as a cmake subdirectory with no unexpected consequence on the rest of your cmake. You will need to be using cmake 3.1 or better.

add_subdirectory(
  "${CMAKE_CURRENT_SOURCE_DIR}/outcome"  # path to outcome source
  "${CMAKE_CURRENT_BINARY_DIR}/outcome"  # your choice of where to put binaries
  EXCLUDE_FROM_ALL                       # please only lazy build outcome on demand
)

Outcome’s cmake has the following useful products: