From 8cd829a53b3df5b739525f15d67ef13e48559557 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 13 Apr 2005 16:46:09 -0400
Subject: [PATCH] COMP: Adding work-around for CMake dependency scanning
 limitation.  Any configured header included by KWSYS_HEADER() in a .c or .cxx
 file in kwsys itself must use this hack to get dependencies.

---
 Base64.c                     |  6 ++++++
 CommandLineArguments.cxx     | 10 ++++++++++
 Directory.cxx                |  9 +++++++++
 ProcessUNIX.c                |  6 ++++++
 ProcessWin32.c               |  6 ++++++
 RegularExpression.cxx        |  6 ++++++
 SystemTools.cxx              | 10 ++++++++++
 test1.cxx                    |  8 ++++++++
 testCommandLineArguments.cxx |  8 +++++++-
 testIOS.cxx                  |  8 ++++++++
 testProcess.c                |  7 +++++++
 testSystemTools.cxx          |  7 +++++++
 testhash.cxx                 | 21 +++++++++++++++++++++
 13 files changed, 111 insertions(+), 1 deletion(-)

diff --git a/Base64.c b/Base64.c
index 3a27a71..00e5a48 100644
--- a/Base64.c
+++ b/Base64.c
@@ -15,6 +15,12 @@
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(Base64.h)
 
+/* Work-around CMake dependency scanning limitation.  This must
+   duplicate the above list of headers.  */
+#if 0
+# include "Base64.h.in"
+#endif
+
 /*--------------------------------------------------------------------------*/
 static const unsigned char kwsysBase64EncodeTable[65] =
 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
diff --git a/CommandLineArguments.cxx b/CommandLineArguments.cxx
index 9ba61a7..55d4816 100644
--- a/CommandLineArguments.cxx
+++ b/CommandLineArguments.cxx
@@ -22,6 +22,16 @@
 #include KWSYS_HEADER(ios/sstream)
 #include KWSYS_HEADER(ios/iostream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "CommandLineArguments.hxx.in"
+# include "Configure.hxx.in"
+# include "kwsys_stl.hxx.in"
+# include "kwsys_ios_sstream.h.in"
+# include "kwsys_ios_iostream.h.in"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/Directory.cxx b/Directory.cxx
index 40b29f0..0357cd3 100644
--- a/Directory.cxx
+++ b/Directory.cxx
@@ -19,6 +19,15 @@
 #include KWSYS_HEADER(stl/string)
 #include KWSYS_HEADER(stl/vector)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "Directory.hxx.in"
+# include "Configure.hxx.in"
+# include "kwsys_stl.hxx.in"
+# include "kwsys_stl_string.hxx.in"
+#endif
+
 namespace KWSYS_NAMESPACE
 {
 
diff --git a/ProcessUNIX.c b/ProcessUNIX.c
index e6c0923..09ef49c 100644
--- a/ProcessUNIX.c
+++ b/ProcessUNIX.c
@@ -14,6 +14,12 @@
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(Process.h)
 
+/* Work-around CMake dependency scanning limitation.  This must
+   duplicate the above list of headers.  */
+#if 0
+# include "Process.h.in"
+#endif
+
 /*
 
 Implementation for UNIX
diff --git a/ProcessWin32.c b/ProcessWin32.c
index fb8ec65..c9c023f 100644
--- a/ProcessWin32.c
+++ b/ProcessWin32.c
@@ -14,6 +14,12 @@
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(Process.h)
 
+/* Work-around CMake dependency scanning limitation.  This must
+   duplicate the above list of headers.  */
+#if 0
+# include "Process.h.in"
+#endif
+
 /*
 
 Implementation for Windows
diff --git a/RegularExpression.cxx b/RegularExpression.cxx
index b0ff99e..edae1df 100644
--- a/RegularExpression.cxx
+++ b/RegularExpression.cxx
@@ -33,6 +33,12 @@
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(RegularExpression.hxx)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "RegularExpression.hxx.in"
+#endif
+
 #include <stdio.h>
 #include <string.h>
 
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 2098e6f..5b53b27 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -19,6 +19,16 @@
 #include KWSYS_HEADER(ios/fstream)
 #include KWSYS_HEADER(ios/sstream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "SystemTools.hxx.in"
+# include "Directory.hxx.in"
+# include "kwsys_ios_iostream.h.in"
+# include "kwsys_ios_fstream.h.in"
+# include "kwsys_ios_sstream.h.in"
+#endif
+
 #ifdef _MSC_VER
 # pragma warning (disable: 4786)
 #endif
diff --git a/test1.cxx b/test1.cxx
index a3f5b2f..c41e824 100644
--- a/test1.cxx
+++ b/test1.cxx
@@ -16,6 +16,14 @@
 #include KWSYS_HEADER(Process.h)
 #include KWSYS_HEADER(ios/iostream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "Directory.hxx.in"
+# include "Process.h.in"
+# include "kwsys_ios_iostream.h.in"
+#endif
+
 int main()
 {
   kwsys::Directory();
diff --git a/testCommandLineArguments.cxx b/testCommandLineArguments.cxx
index 6ed1046..75540be 100644
--- a/testCommandLineArguments.cxx
+++ b/testCommandLineArguments.cxx
@@ -12,10 +12,16 @@
 
 =========================================================================*/
 #include "kwsysPrivate.h"
-
 #include KWSYS_HEADER(CommandLineArguments.hxx)
 #include KWSYS_HEADER(ios/iostream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "CommandLineArguments.hxx.in"
+# include "kwsys_ios_iostream.h.in"
+#endif
+
 void* random_ptr = (void*)0x123;
 
 int argument(const char* arg, const char* value, void* call_data)
diff --git a/testIOS.cxx b/testIOS.cxx
index a6f33d8..d699ae5 100644
--- a/testIOS.cxx
+++ b/testIOS.cxx
@@ -3,6 +3,14 @@
 #include KWSYS_HEADER(ios/sstream)
 #include KWSYS_HEADER(ios/iostream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "kwsys_stl_vector.h.in"
+# include "kwsys_ios_sstream.h.in"
+# include "kwsys_ios_iostream.h.in"
+#endif
+
 int main()
 {
   kwsys_ios::ostringstream ostr;
diff --git a/testProcess.c b/testProcess.c
index 45650ce..ea80fea 100644
--- a/testProcess.c
+++ b/testProcess.c
@@ -13,6 +13,13 @@
 =========================================================================*/
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(Process.h)
+
+/* Work-around CMake dependency scanning limitation.  This must
+   duplicate the above list of headers.  */
+#if 0
+# include "Process.h.in"
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 0f578c1..8249b2d 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -15,6 +15,13 @@
 #include KWSYS_HEADER(SystemTools.hxx)
 #include KWSYS_HEADER(ios/iostream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "SystemTools.hxx.in"
+# include "kwsys_ios_iostream.h.in"
+#endif
+
 const char* toUnixPaths[][2] = 
 {
     { "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
diff --git a/testhash.cxx b/testhash.cxx
index 8360a18..68d6bbf 100644
--- a/testhash.cxx
+++ b/testhash.cxx
@@ -1,8 +1,29 @@
+/*=========================================================================
+
+  Program:   KWSys - Kitware System Library
+  Module:    testhash.cxx
+
+  Copyright (c) Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(hash_map.hxx)
 #include KWSYS_HEADER(hash_set.hxx)
 #include KWSYS_HEADER(ios/iostream)
 
+// Work-around CMake dependency scanning limitation.  This must
+// duplicate the above list of headers.
+#if 0
+# include "hash_map.hxx.in"
+# include "hash_set.hxx.in"
+# include "kwsys_ios_iostream.h.in"
+#endif
+
 #if defined(_MSC_VER)
 # pragma warning (disable:4786)
 #endif
-- 
GitLab