summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-05-07 22:11:16 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-05-07 22:11:16 (GMT)
commit885e37da224353e242e7135b0fc8e6f2445a54c7 (patch)
tree17effe2cbc6b46afcd670ffe45f0fcbb8c7d01b6 /Source/cmSystemTools.cxx
parent5066defc2378172be5bcfc22238d9cb68f05bb29 (diff)
downloadCMake-885e37da224353e242e7135b0fc8e6f2445a54c7.zip
CMake-885e37da224353e242e7135b0fc8e6f2445a54c7.tar.gz
CMake-885e37da224353e242e7135b0fc8e6f2445a54c7.tar.bz2
ENH: call configure from cmake
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7e01101..afc92e8 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -563,6 +563,10 @@ bool cmSystemTools::IsOff(const char* val)
bool cmSystemTools::RunCommand(const char* command,
std::string& output)
{
+ const int BUFFER_SIZE = 4096;
+ char buffer[BUFFER_SIZE];
+
+#if defined(WIN32) && !defined(__CYGWIN__)
std::string commandToFile = command;
commandToFile += " > ";
std::string tempFile;
@@ -576,8 +580,6 @@ bool cmSystemTools::RunCommand(const char* command,
tempFile.c_str());
return false;
}
- const int BUFFER_SIZE = 4096;
- char buffer[BUFFER_SIZE];
while(fin)
{
fin.getline(buffer, BUFFER_SIZE);
@@ -585,6 +587,22 @@ bool cmSystemTools::RunCommand(const char* command,
}
cmSystemTools::RemoveFile(tempFile.c_str());
return true;
+#else
+ std::cout << "runing " << command << std::endl;
+ FILE* cpipe = popen(command, "r");
+ if(!cpipe)
+ {
+ return false;
+ }
+ fgets(buffer, BUFFER_SIZE, cpipe);
+ while(!feof(cpipe))
+ {
+ std::cout << buffer;
+ output += buffer;
+ fgets(buffer, BUFFER_SIZE, cpipe);
+ }
+ fclose(cpipe);
+#endif
}
#ifdef _MSC_VER