summaryrefslogtreecommitdiff
path: root/Source/cmConfigureFileNoAutoconf.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-02-12 19:49:52 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2001-02-12 19:49:52 -0500
commitdb267f533b9ac63db78559e9d3cb39a6db090770 (patch)
treec1d9cbee32d5de1e522e2c2ab5503ec82fb39f2c /Source/cmConfigureFileNoAutoconf.cxx
parent9d431ae48b0912454405d5eaabf7ce11561fd4ec (diff)
downloadcmake-db267f533b9ac63db78559e9d3cb39a6db090770.tar.gz
ENH: get rid of special msc configure file
Diffstat (limited to 'Source/cmConfigureFileNoAutoconf.cxx')
-rw-r--r--Source/cmConfigureFileNoAutoconf.cxx67
1 files changed, 67 insertions, 0 deletions
diff --git a/Source/cmConfigureFileNoAutoconf.cxx b/Source/cmConfigureFileNoAutoconf.cxx
new file mode 100644
index 0000000000..86a5897f20
--- /dev/null
+++ b/Source/cmConfigureFileNoAutoconf.cxx
@@ -0,0 +1,67 @@
+/*=========================================================================
+
+ Program: Insight Segmentation & Registration Toolkit
+ Module: $RCSfile$
+ Language: C++
+ Date: $Date$
+ Version: $Revision$
+
+
+ Copyright (c) 2000 National Library of Medicine
+ All rights reserved.
+
+ See COPYRIGHT.txt for copyright details.
+
+=========================================================================*/
+#include "cmConfigureFileNoAutoconf.h"
+
+// cmConfigureFileNoAutoconf
+bool cmConfigureFileNoAutoconf::Invoke(std::vector<std::string>& args)
+{
+ if(args.size() != 2 )
+ {
+ this->SetError("called with incorrect number of arguments, expected 2");
+ return false;
+ }
+ m_InputFile = args[0];
+ m_OuputFile = args[1];
+ return true;
+}
+
+void cmConfigureFileNoAutoconf::FinalPass()
+{
+#ifdef CMAKE_HAS_AUTOCONF
+ return;
+#else
+ m_Makefile->ExpandVariblesInString(m_InputFile);
+ m_Makefile->ExpandVariblesInString(m_OuputFile);
+ std::ifstream fin(m_InputFile.c_str());
+ if(!fin)
+ {
+ cmSystemTools::Error("Could not open file for read in copy operatation",
+ m_InputFile.c_str());
+ return;
+ }
+ std::ofstream fout(m_OuputFile.c_str());
+ if(!fout)
+ {
+ cmSystemTools::Error("Could not open file for write in copy operatation",
+ m_OuputFile.c_str());
+ return;
+ }
+ // now copy input to output and expand varibles in the
+ // input file at the same time
+ const int bufSize = 4096;
+ char buffer[bufSize];
+ std::string inLine;
+ while(fin)
+ {
+ fin.getline(buffer, bufSize);
+ inLine = buffer;
+ m_Makefile->ExpandVariblesInString(inLine);
+ fout << inLine << "\n";
+ }
+#endif
+}
+
+