libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
Configuration Options And Macros

CMake options and the preprocessor macros that expose those choices. More...

Topics

 EnableGlibCxxDebug (CWDEBUG_GLIBCXX_DEBUG)
 EnableLibcwdLocation (CWDEBUG_LOCATION)
 EnableLibcwdDebug (CWDEBUG_DEBUG)
 EnableLibcwdDebugOutput (CWDEBUG_DEBUGOUTPUT)
 EnableLibcwdDebugt (CWDEBUG_DEBUGT)

Detailed Description

Libcwd uses CMake for configuration. You can list cached options with cmake -LAH <build-dir> .

This section describes the CMake options specific to libcwd. The name of the macros that are related to the respective features are given between parenthesis after the option. You can not define these macros yourself, you may only use them in an #if ... #endif test. The macros are always defined; when the corresponding CMake option was enabled then the macro is defined to 1, otherwise it is defined to 0. This makes it possible for the compiler to warn you when you made a typo in the name of a macro (add -Wundef to your compile flags for that).

Example:

// Use '#if' not '#ifdef'.
#if CWDEBUG_LOCATION
Dout(dc::notice, "Called from " << libcwd::Location(__builtin_return_address(0)));
#endif
A source file location.
Definition Location.h:58
#define Dout(cntrl,...)
Macro for writing debug output.
Definition debug.h:97

How to configure libcwd when using gitache

If you're using gitache to download/configure/compile/install libcwd, put the following content (relative to the root of your project) in cmake/gitache-configs/libcwd.cmake:

gitache_config(
GIT_REPOSITORY
"https://github.com/CarloWood/libcwd.git"
GIT_TAG
"master"
)

Optionally add a CMAKE_ARGS. For example, to toggle all default options:

CMAKE_ARGS
"-DEnableGlibCxxDebug=ON -DEnableLibcwdLocation=OFF -DEnableLibcwdDebug=ON -DEnableLibcwdDebugOutput=ON"

Then use libcwd as package name in your CMakeLists.txt:

set(GITACHE_PACKAGES libcwd)

You must use libcwd here for version 2, because gitache sets <package-name>_ROOT to where the package is found, and that only works with find_package if <package-name> is the actual library name. For the same reason, for version 1 you should continue to use libcwd_r.