diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 422b03859cf7fa693a79077686c6dedeb60f5a85..f335b8bc532739a3ac138e49db5818dc02561f77 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -172,7 +172,9 @@ bool cmExportCommand
   ebfg.SetCommand(this);
   ebfg.SetExportOld(this->ExportOld.IsEnabled());
 
-  this->Makefile->AddExportedTargetsFile(fname);
+  cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()
+                                        ->GetGlobalGenerator();
+  gg->AddExportedTargetsFile(fname);
 
   // Compute the set of configurations exported.
   std::vector<std::string> configurationTypes;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 70f6e32b2cc115bc6a0bfaeeeea893a5927fb21a..b8860f1f23b3bdb8c30e92f174de3eb9cf832964 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -293,6 +293,18 @@ public:
 
   void ProcessEvaluationFiles();
 
+  void AddExportedTargetsFile(const std::string &filename)
+  {
+    this->ExportedTargetsFiles.insert(filename);
+  }
+
+  bool IsExportedTargetsFile(const std::string &filename) const
+  {
+    const std::set<std::string>::const_iterator it
+                                  = this->ExportedTargetsFiles.find(filename);
+    return it != this->ExportedTargetsFiles.end();
+  }
+
 protected:
   typedef std::vector<cmLocalGenerator*> GeneratorVector;
   // for a project collect all its targets by following depend
@@ -372,6 +384,7 @@ private:
   std::map<cmStdString, cmStdString> ExtensionToLanguage;
   std::map<cmStdString, int> LanguageToLinkerPreference;
   std::map<cmStdString, cmStdString> LanguageToOriginalSharedLibFlags;
+  std::set<std::string> ExportedTargetsFiles;
 
   // Record hashes for rules and outputs.
   struct RuleHash { char Data[32]; };
diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx
index a3d8b83007e455a185c891493ee416ad4d4d32b7..39d4993eba6c8f8807524517ec0d56b4341bdb73 100644
--- a/Source/cmIncludeCommand.cxx
+++ b/Source/cmIncludeCommand.cxx
@@ -93,7 +93,9 @@ bool cmIncludeCommand
       cmSystemTools::CollapseFullPath(fname.c_str(),
                                       this->Makefile->GetStartDirectory());
 
-  if (this->Makefile->IsExportedTargetsFile(fname_abs))
+  cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator()
+                                        ->GetGlobalGenerator();
+  if (gg->IsExportedTargetsFile(fname_abs))
     {
     const char *modal = 0;
     cmake::MessageType messageType = cmake::AUTHOR_WARNING;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 362b0664a741799354d9b62acd220251cd3c3c28..ca8233669d39b912f663c431646f7f8ca7d4eed3 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -489,18 +489,6 @@ public:
       return this->cmCurrentListFile.c_str();
     }
 
-  void AddExportedTargetsFile(const std::string &filename)
-  {
-    this->ExportedTargetsFiles.insert(filename);
-  }
-
-  bool IsExportedTargetsFile(const std::string &filename) const
-  {
-    const std::set<std::string>::const_iterator it
-                                  = this->ExportedTargetsFiles.find(filename);
-    return it != this->ExportedTargetsFiles.end();
-  }
-
   //@}
 
   /**
@@ -1053,7 +1041,6 @@ private:
   void EnforceDirectoryLevelRules();
 
   bool GeneratingBuildSystem;
-  std::set<std::string> ExportedTargetsFiles;
   /**
    * Old version of GetSourceFileWithOutput(const char*) kept for
    * backward-compatibility. It implements a linear search and support
diff --git a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt
index 182c67a4660c454d94271ff4f4e8c3556f16c9b9..059d7e45ac56e50723e2c4c8867ec116c8397ecd 100644
--- a/Tests/RunCMake/include/CMP0024-NEW-stderr.txt
+++ b/Tests/RunCMake/include/CMP0024-NEW-stderr.txt
@@ -1,15 +1,12 @@
-CMake Error at CMP0024-NEW.cmake:9 \(include\):
+CMake Error at subdir2/CMakeLists.txt:2 \(include\):
   Policy CMP0024 is not set: Disallow include export result.  Run "cmake
   --help-policy CMP0024" for policy details.  Use the cmake_policy command to
   set the policy and suppress this warning.
 
   The file
 
-    .*/Tests/RunCMake/include/CMP0024-NEW-build/theTargets.cmake
+    .*/Tests/RunCMake/include/CMP0024-NEW-build/subdir1/theTargets.cmake
 
   was generated by the export\(\) command.  It may not be used as the argument
   to the include\(\) command.  Use ALIAS targets instead to refer to targets by
   alternative names.
-
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/include/CMP0024-NEW.cmake b/Tests/RunCMake/include/CMP0024-NEW.cmake
index 0685d6c4131345b0972868bf7b2abc368348a8e6..0e03d2af85a2857d95d5c78ee223367fd4313417 100644
--- a/Tests/RunCMake/include/CMP0024-NEW.cmake
+++ b/Tests/RunCMake/include/CMP0024-NEW.cmake
@@ -5,5 +5,5 @@ cmake_policy(SET CMP0024 NEW)
 
 add_library(foo SHARED empty.cpp)
 
-export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
-include("${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
+add_subdirectory(subdir1)
+add_subdirectory(subdir2)
diff --git a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt
index 2b36f173163b0d36f728f632b1b44fac35838b13..9c790070589fbc07f035f92d08bc8f08da911745 100644
--- a/Tests/RunCMake/include/CMP0024-WARN-stderr.txt
+++ b/Tests/RunCMake/include/CMP0024-WARN-stderr.txt
@@ -1,16 +1,14 @@
-CMake Warning \(dev\) at CMP0024-WARN.cmake:7 \(include\):
+CMake Warning \(dev\) at subdir2/CMakeLists.txt:2 \(include\):
   Policy CMP0024 is not set: Disallow include export result.  Run "cmake
   --help-policy CMP0024" for policy details.  Use the cmake_policy command to
   set the policy and suppress this warning.
 
   The file
 
-    .*/Tests/RunCMake/include/CMP0024-WARN-build/theTargets.cmake
+    .*/Tests/RunCMake/include/CMP0024-WARN-build/subdir1/theTargets.cmake
 
   was generated by the export\(\) command.  It should not be used as the
   argument to the include\(\) command.  Use ALIAS targets instead to refer to
   targets by alternative names.
 
-Call Stack \(most recent call first\):
-  CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/include/CMP0024-WARN.cmake b/Tests/RunCMake/include/CMP0024-WARN.cmake
index 583c7d426ddeb666a2911456802505fdb085afd3..783cf78e5d5502f186bb38ea304e60c7fa8cfc6e 100644
--- a/Tests/RunCMake/include/CMP0024-WARN.cmake
+++ b/Tests/RunCMake/include/CMP0024-WARN.cmake
@@ -3,5 +3,5 @@ enable_language(CXX)
 
 add_library(foo SHARED empty.cpp)
 
-export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
-include("${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
+add_subdirectory(subdir1)
+add_subdirectory(subdir2)
diff --git a/Tests/RunCMake/include/subdir1/CMakeLists.txt b/Tests/RunCMake/include/subdir1/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..11a76d1dd3be456cd9c93c96ba5945e2f63ebb09
--- /dev/null
+++ b/Tests/RunCMake/include/subdir1/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+export(TARGETS foo FILE "${CMAKE_CURRENT_BINARY_DIR}/theTargets.cmake")
diff --git a/Tests/RunCMake/include/subdir2/CMakeLists.txt b/Tests/RunCMake/include/subdir2/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7361f9cb119e126e6c2c0cf48b9093ea7de2c460
--- /dev/null
+++ b/Tests/RunCMake/include/subdir2/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+include("${CMAKE_CURRENT_BINARY_DIR}/../subdir1/theTargets.cmake")