summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-03 02:25:43 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-03 02:25:43 (GMT)
commit69ca8776a8a63fcc4d14f59afc1ab8980bb70e9e (patch)
treef304319e636d26ad478e83e43346f873a69fd26d /Source/cmake.cxx
parent5a25895c1cd62a638b270b8d9aaa15a5d500647b (diff)
downloadCMake-69ca8776a8a63fcc4d14f59afc1ab8980bb70e9e.zip
CMake-69ca8776a8a63fcc4d14f59afc1ab8980bb70e9e.tar.gz
CMake-69ca8776a8a63fcc4d14f59afc1ab8980bb70e9e.tar.bz2
ENH: Start adding the code that will truncate output logs
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 636c766..ffb6ff2 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -65,6 +65,8 @@
# include <sys/resource.h>
#endif
+#include <sys/stat.h> // struct stat
+
#include <memory> // auto_ptr
void cmNeedBackwardsCompatibility(const std::string& variable,
@@ -1107,6 +1109,9 @@ int cmake::Configure()
cmCacheManager::STRING);
}
+ this->TruncateOutputLog("CMakeOutput.log");
+ this->TruncateOutputLog("CMakeError.log");
+
// no generator specified on the command line
if(!m_GlobalGenerator)
{
@@ -1696,3 +1701,29 @@ int cmake::CheckBuildSystem()
// No need to rerun.
return 0;
}
+
+//----------------------------------------------------------------------------
+void cmake::TruncateOutputLog(const char* fname)
+{
+ std::string fullPath = this->GetHomeOutputDirectory();
+ fullPath += "/";
+ fullPath += fname;
+ struct stat st;
+ if ( ::stat(fullPath.c_str(), &st) )
+ {
+ return;
+ }
+ if ( !m_CacheManager->GetCacheValue("CMAKE_CACHEFILE_DIR") )
+ {
+ cmSystemTools::RemoveFile(fullPath.c_str());
+ return;
+ }
+ size_t fsize = st.st_size;
+ const size_t maxFileSize = 50 * 1024;
+ if ( fsize < maxFileSize )
+ {
+ //TODO: truncate file
+ return;
+ }
+}
+