summaryrefslogtreecommitdiffstats
path: root/Source/cmCreateTestSourceList.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2004-05-27 16:56:52 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2004-05-27 16:56:52 (GMT)
commit42bc978b5b4bffb64db2be7f2fdb28094ecd4661 (patch)
tree248421a0ed6dc34972af3f9f0d5d87f73757f957 /Source/cmCreateTestSourceList.cxx
parentd1470b7d7c65b22f3f93183e68b1f8fed73e82fe (diff)
downloadCMake-42bc978b5b4bffb64db2be7f2fdb28094ecd4661.zip
CMake-42bc978b5b4bffb64db2be7f2fdb28094ecd4661.tar.gz
CMake-42bc978b5b4bffb64db2be7f2fdb28094ecd4661.tar.bz2
BUG: When creating a test driver, do not remove the old file, so if nothing changes, it will not rebuild. Fixes Bug #885 - cmCreateTestSource overwrite file when running cmake
Diffstat (limited to 'Source/cmCreateTestSourceList.cxx')
-rw-r--r--Source/cmCreateTestSourceList.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx
index 51931ba..5dddb9e 100644
--- a/Source/cmCreateTestSourceList.cxx
+++ b/Source/cmCreateTestSourceList.cxx
@@ -81,15 +81,6 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
driver += *i;
++i;
- std::ofstream fout(driver.c_str());
- if (!fout)
- {
- std::string err = "Could not create file ";
- err += driver;
- err += " for cmCreateTestSourceList command.";
- this->SetError(err.c_str());
- return false;
- }
std::string configFile =
m_Makefile->GetDefinition("CMAKE_ROOT");
configFile += "/Templates/TestDriver.cxx.in";
@@ -166,7 +157,11 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
}
m_Makefile->AddDefinition("CMAKE_FORWARD_DECLARE_TESTS", forwardDeclareCode.c_str());
m_Makefile->AddDefinition("CMAKE_FUNCTION_TABLE_ENTIRES", functionMapCode.c_str());
- m_Makefile->ConfigureFile(configFile.c_str(), driver.c_str(), false, true, false);
+ bool res = true;
+ if ( !m_Makefile->ConfigureFile(configFile.c_str(), driver.c_str(), false, true, false) )
+ {
+ res = false;
+ }
// Create the source list
cmSourceFile cfile;
@@ -194,7 +189,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
}
m_Makefile->AddDefinition(sourceList, sourceListValue.c_str());
- return true;
+ return res;
}