Fix fallback stringifier config

This commit is contained in:
Martin Hořeňovský 2022-02-20 13:17:40 +01:00
parent 0c722564c3
commit bda4b7df84
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -177,6 +177,7 @@
#cmakedefine CATCH_CONFIG_PREFIX_ALL #cmakedefine CATCH_CONFIG_PREFIX_ALL
#cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG
// ------ // ------
// "Variable" defines, these have actual values // "Variable" defines, these have actual values
// ------ // ------
@ -184,18 +185,10 @@
#define CATCH_CONFIG_DEFAULT_REPORTER "@CATCH_CONFIG_DEFAULT_REPORTER@" #define CATCH_CONFIG_DEFAULT_REPORTER "@CATCH_CONFIG_DEFAULT_REPORTER@"
#define CATCH_CONFIG_CONSOLE_WIDTH @CATCH_CONFIG_CONSOLE_WIDTH@ #define CATCH_CONFIG_CONSOLE_WIDTH @CATCH_CONFIG_CONSOLE_WIDTH@
// The logic here depends on CMake preprocessing of the file significantly. // Unlike the macros above, CATCH_CONFIG_FALLBACK_STRINGIFIER does not
// If CMake has CATCH_CONFIG_FALLBACK_STRINGIFIER it will be define below, // have a good default value, so we cannot always define it, and cannot
// and its value is written into the if. Thus, we undef the old placeholder // even expose it as a variable in CMake. The users will have to find
// and then define the macro to the actual CMake-provided value. // out about it from docs and set it only if they use it.
// #cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@
// We can't do it without this indirection, because it is a string-variable
// macro, so we need it's value, and there is no usable default value that
// would let us have it always defined the way the other two are.
#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER
#if defined( CATCH_CONFIG_FALLBACK_STRINGIFIER )
# undef CATCH_CONFIG_FALLBACK_STRINGIFIER
# define CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@
#endif
#endif // CATCH_USER_CONFIG_HPP_INCLUDED #endif // CATCH_USER_CONFIG_HPP_INCLUDED