From 281f59536f8c16f9eacf175f8316a82f09629203 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Fri, 25 May 2018 12:43:26 -0400
Subject: IWYU: Define a macro to tell code it is preprocessing for iwyu

There are some cases where satisfying IWYU breaks compilation, such as
forward-declaring the `std::hash<>` template with C++ standard libraries
that use an inline namespace inside `std`.  Define a macro during
include-what-you-use preprocessing so that code can adapt.
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ee67cb..e20d770 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -285,7 +285,7 @@ if(CMake_RUN_IWYU)
     message(FATAL_ERROR "CMake_RUN_IWYU is ON but include-what-you-use is not found!")
   endif()
   set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE
-    "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w")
+    "${IWYU_COMMAND};-Xiwyu;--mapping_file=${CMake_SOURCE_DIR}/Utilities/IWYU/mapping.imp;-w;-DCMAKE_IWYU")
 endif()
 
 
-- 
cgit v0.12