-
Notifications
You must be signed in to change notification settings - Fork 216
Setting up a custom standard library
When the default standard library shipped with your system is too old for Hana to use, you can either install a new standard library system-wide, or install it locally and tell Hana how to use it. To do so, you must specify
-
A custom header search path. This instructs the compiler to look for headers in the
/path/to/std-includes
directory. This way, when you#include <type_traits>
, for example, it will look for that header in the/path/to/std-includes
directory.export CXXFLAGS="-I /path/to/std-includes"
-
A custom library search path and library to link against. This instructs the linker to search for libraries in the
/path/to/std-library
directory, and to link against thestd-library
library, which should be present in the directory you provided.export LDFLAGS="-L /path/to/std-library -l std-library"
-
A custom search path for loading shared libraries at runtime. This will be looked up by your program at startup time.
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/path/to/std-library"
For example, using a custom libc++ on my Linux box looks like:
export CXXFLAGS="-I ${HOME}/code/llvm36/build/include/c++/v1"
export LDFLAGS="-L ${HOME}/code/llvm36/build/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/code/llvm36/build/lib"
cmake .. -DCMAKE_CXX_COMPILER=clang++-3.6