summaryrefslogtreecommitdiff
path: root/Tests/Complex
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-09-01 12:19:33 -0400
committerBrad King <brad.king@kitware.com>2022-09-01 12:29:22 -0400
commit44189d82a7d20d0d74c6d4c8c5ac9314a5af4947 (patch)
treeb26bb7b2a3abb3d1ed53e5be5e4c185aefd37c77 /Tests/Complex
parentd10cbb05906de570f45d873296867dad4f90d93a (diff)
downloadcmake-44189d82a7d20d0d74c6d4c8c5ac9314a5af4947.tar.gz
Tests: Fix some tests under CFLAGS=-DNDEBUG CXXFLAGS=-DNDEBUG
Fixes: #23888
Diffstat (limited to 'Tests/Complex')
-rw-r--r--Tests/Complex/CMakeLists.txt8
-rw-r--r--Tests/Complex/Executable/complex.cxx2
2 files changed, 9 insertions, 1 deletions
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt
index 5df22d25f1..9493a2fa4e 100644
--- a/Tests/Complex/CMakeLists.txt
+++ b/Tests/Complex/CMakeLists.txt
@@ -5,6 +5,14 @@ cmake_minimum_required(VERSION 2.4)
cmake_policy(SET CMP0054 NEW)
project (Complex)
+# Inform the test if the debug configuration is getting built.
+string(APPEND CMAKE_C_FLAGS_RELEASE " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_C_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
+string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL " -DCOMPLEX_NDEBUG")
+
# Test that renaming a built-in works when configured multiple times.
message("message")
function(message)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 49e97d5856..67a1645218 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -62,7 +62,7 @@ void cmPassed(const char* Message, const char* m2 = "")
# error This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work
#endif
-#if defined(NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
+#if defined(COMPLEX_NDEBUG) && !defined(CMAKE_IS_FUN_IN_RELEASE_MODE)
# error Per-configuration directory-level definition not inherited.
#endif