summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorVitaly Stakhovsky <vvs31415@gitlab.org>2019-01-23 01:37:59 (GMT)
committerVitaly Stakhovsky <vvs31415@gitlab.org>2019-01-23 01:37:59 (GMT)
commit9e5c13738bdc45b00b529b492bad92800890fb9c (patch)
treeee07703b2cf6a7178c7f76f934f828afe2b3764e /Source/cmake.cxx
parentfa5bf870df1ce5d9cbcf61be736beb0b1e87b85b (diff)
downloadCMake-9e5c13738bdc45b00b529b492bad92800890fb9c.zip
CMake-9e5c13738bdc45b00b529b492bad92800890fb9c.tar.gz
CMake-9e5c13738bdc45b00b529b492bad92800890fb9c.tar.bz2
cmSystemTools::RenameFile: Accepts std::string args
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx27
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 065f6df..e792771 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -115,8 +115,10 @@ typedef std::unordered_map<std::string, Json::Value> JsonValueMapType;
} // namespace
-static bool cmakeCheckStampFile(const char* stampName, bool verbose = true);
-static bool cmakeCheckStampList(const char* stampList, bool verbose = true);
+static bool cmakeCheckStampFile(const std::string& stampName,
+ bool verbose = true);
+static bool cmakeCheckStampList(const std::string& stampList,
+ bool verbose = true);
void cmWarnUnusedCliWarning(const std::string& variable, int /*unused*/,
void* ctx, const char* /*unused*/,
@@ -1626,13 +1628,13 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
// If we are given a stamp list file check if it is really out of date.
if (!this->CheckStampList.empty() &&
- cmakeCheckStampList(this->CheckStampList.c_str())) {
+ cmakeCheckStampList(this->CheckStampList)) {
return 0;
}
// If we are given a stamp file check if it is really out of date.
if (!this->CheckStampFile.empty() &&
- cmakeCheckStampFile(this->CheckStampFile.c_str())) {
+ cmakeCheckStampFile(this->CheckStampFile)) {
return 0;
}
@@ -2413,7 +2415,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
return 0;
}
-static bool cmakeCheckStampFile(const char* stampName, bool verbose)
+static bool cmakeCheckStampFile(const std::string& stampName, bool verbose)
{
// The stamp file does not exist. Use the stamp dependencies to
// determine whether it is really out of date. This works in
@@ -2458,12 +2460,11 @@ static bool cmakeCheckStampFile(const char* stampName, bool verbose)
// by the VS IDE due to a "rebuild" request. Restore it atomically.
std::ostringstream stampTempStream;
stampTempStream << stampName << ".tmp" << cmSystemTools::RandomSeed();
- std::string stampTempString = stampTempStream.str();
- const char* stampTemp = stampTempString.c_str();
+ std::string stampTemp = stampTempStream.str();
{
// TODO: Teach cmGeneratedFileStream to use a random temp file (with
// multiple tries in unlikely case of conflict) and use that here.
- cmsys::ofstream stamp(stampTemp);
+ cmsys::ofstream stamp(stampTemp.c_str());
stamp << "# CMake generation timestamp file for this directory.\n";
}
if (cmSystemTools::RenameFile(stampTemp, stampName)) {
@@ -2477,11 +2478,11 @@ static bool cmakeCheckStampFile(const char* stampName, bool verbose)
return true;
}
cmSystemTools::RemoveFile(stampTemp);
- cmSystemTools::Error("Cannot restore timestamp ", stampName);
+ cmSystemTools::Error("Cannot restore timestamp ", stampName.c_str());
return false;
}
-static bool cmakeCheckStampList(const char* stampList, bool verbose)
+static bool cmakeCheckStampList(const std::string& stampList, bool verbose)
{
// If the stamp list does not exist CMake must rerun to generate it.
if (!cmSystemTools::FileExists(stampList)) {
@@ -2489,7 +2490,7 @@ static bool cmakeCheckStampList(const char* stampList, bool verbose)
<< "is missing.\n";
return false;
}
- cmsys::ifstream fin(stampList);
+ cmsys::ifstream fin(stampList.c_str());
if (!fin) {
std::cout << "CMake is re-running because generate.stamp.list "
<< "could not be read.\n";
@@ -2499,7 +2500,7 @@ static bool cmakeCheckStampList(const char* stampList, bool verbose)
// Check each stamp.
std::string stampName;
while (cmSystemTools::GetLineFromStream(fin, stampName)) {
- if (!cmakeCheckStampFile(stampName.c_str(), verbose)) {
+ if (!cmakeCheckStampFile(stampName, verbose)) {
return false;
}
}
@@ -2620,7 +2621,7 @@ int cmake::Build(int jobs, const std::string& dir, const std::string& target,
}
}
- if (!cmakeCheckStampList(stampList.c_str(), false)) {
+ if (!cmakeCheckStampList(stampList, false)) {
// Correctly initialize the home (=source) and home output (=binary)
// directories, which is required for running the generation step.
std::string homeOrig = this->GetHomeDirectory();