From bda4b7df844b7d6f68aa0faacfa17a348b02937f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 20 Feb 2022 13:17:40 +0100 Subject: [PATCH] Fix fallback stringifier config --- src/catch2/catch_user_config.hpp.in | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/catch2/catch_user_config.hpp.in b/src/catch2/catch_user_config.hpp.in index 3cfbed4a..b3a518f9 100644 --- a/src/catch2/catch_user_config.hpp.in +++ b/src/catch2/catch_user_config.hpp.in @@ -177,6 +177,7 @@ #cmakedefine CATCH_CONFIG_PREFIX_ALL #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG + // ------ // "Variable" defines, these have actual values // ------ @@ -184,18 +185,10 @@ #define CATCH_CONFIG_DEFAULT_REPORTER "@CATCH_CONFIG_DEFAULT_REPORTER@" #define CATCH_CONFIG_CONSOLE_WIDTH @CATCH_CONFIG_CONSOLE_WIDTH@ -// The logic here depends on CMake preprocessing of the file significantly. -// If CMake has CATCH_CONFIG_FALLBACK_STRINGIFIER it will be define below, -// and its value is written into the if. Thus, we undef the old placeholder -// and then define the macro to the actual CMake-provided value. -// -// 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 +// Unlike the macros above, CATCH_CONFIG_FALLBACK_STRINGIFIER does not +// have a good default value, so we cannot always define it, and cannot +// even expose it as a variable in CMake. The users will have to find +// out about it from docs and set it only if they use it. +#cmakedefine CATCH_CONFIG_FALLBACK_STRINGIFIER @CATCH_CONFIG_FALLBACK_STRINGIFIER@ #endif // CATCH_USER_CONFIG_HPP_INCLUDED