summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx23
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx16
-rw-r--r--Source/CTest/cmCTestBuildHandler.h4
-rw-r--r--Source/CTest/cmCTestConfigureHandler.cxx12
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx25
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx22
-rw-r--r--Source/CTest/cmCTestRunTest.cxx10
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx42
-rw-r--r--Source/CTest/cmCTestScriptHandler.h4
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx36
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx25
-rw-r--r--Source/CTest/cmCTestTestHandler.h3
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx12
-rw-r--r--Source/CTest/cmProcess.cxx14
-rw-r--r--Source/CTest/cmProcess.h3
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx4
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefile.cxx5
-rw-r--r--Source/cmPolicies.h5
-rw-r--r--Source/cmServerProtocol.cxx15
-rw-r--r--Source/cmSourceGroup.cxx10
-rw-r--r--Source/cmSourceGroup.h4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx17
25 files changed, 199 insertions, 120 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a7727d2..eaa4679 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 10)
-set(CMake_VERSION_PATCH 20171114)
+set(CMake_VERSION_PATCH 20171120)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index a0d68a0..b603758 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -10,6 +10,7 @@
#include "cmake.h"
#include "cmsys/Process.h"
+#include <chrono>
#include <stdlib.h>
cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
@@ -192,7 +193,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// we need to honor the timeout specified, the timeout include cmake, build
// and test time
- double clock_start = cmSystemTools::GetTime();
+ auto clock_start = std::chrono::steady_clock::now();
// make sure the binary dir is there
out << "Internal cmake changing into directory: " << this->BinaryDir
@@ -222,10 +223,12 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
this->BuildTargets.push_back("");
}
for (std::string const& tar : this->BuildTargets) {
- double remainingTime = 0;
+ std::chrono::duration<double> remainingTime = std::chrono::seconds(0);
if (this->Timeout > 0) {
- remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
- if (remainingTime <= 0) {
+ remainingTime = std::chrono::duration<double>(this->Timeout) -
+ std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::steady_clock::now() - clock_start);
+ if (remainingTime <= std::chrono::seconds(0)) {
if (outstring) {
*outstring = "--build-and-test timeout exceeded. ";
}
@@ -248,7 +251,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
int retVal = cm.GetGlobalGenerator()->Build(
this->SourceDir, this->BinaryDir, this->BuildProject, tar, output,
this->BuildMakeProgram, config, !this->BuildNoClean, false, false,
- remainingTime);
+ remainingTime.count());
out << output;
// if the build failed then return
if (retVal) {
@@ -320,10 +323,12 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
out << "\n";
// how much time is remaining
- double remainingTime = 0;
+ std::chrono::duration<double> remainingTime = std::chrono::seconds(0);
if (this->Timeout > 0) {
- remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
- if (remainingTime <= 0) {
+ remainingTime = std::chrono::duration<double>(this->Timeout) -
+ std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::steady_clock::now() - clock_start);
+ if (remainingTime <= std::chrono::seconds(0)) {
if (outstring) {
*outstring = "--build-and-test timeout exceeded. ";
}
@@ -332,7 +337,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
}
int runTestRes = this->CTest->RunTest(testCommand, &outs, &retval, nullptr,
- remainingTime, nullptr);
+ remainingTime.count(), nullptr);
if (runTestRes != cmsysProcess_State_Exited || retval != 0) {
out << "Test command failed: " << testCommand[0] << "\n";
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index f4fc769..4ad4831 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -17,6 +17,7 @@
#include <set>
#include <stdlib.h>
#include <string.h>
+#include <type_traits>
static const char* cmCTestErrorMatches[] = {
"^[Bb]us [Ee]rror",
@@ -327,7 +328,7 @@ int cmCTestBuildHandler::ProcessHandler()
// Create a last build log
cmGeneratedFileStream ofs;
- double elapsed_time_start = cmSystemTools::GetTime();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
if (!this->StartLogFile("Build", ofs)) {
cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create build log file"
<< std::endl);
@@ -421,7 +422,8 @@ int cmCTestBuildHandler::ProcessHandler()
// Remember end build time and calculate elapsed time
this->EndBuild = this->CTest->CurrentTime();
this->EndBuildTime = cmSystemTools::GetTime();
- double elapsed_build_time = cmSystemTools::GetTime() - elapsed_time_start;
+ auto elapsed_build_time =
+ std::chrono::steady_clock::now() - elapsed_time_start;
// Cleanups strings in the errors and warnings list.
if (!this->SimplifySourceDir.empty()) {
@@ -633,8 +635,8 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml)
}
}
-void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml,
- double elapsed_build_time)
+void cmCTestBuildHandler::GenerateXMLFooter(
+ cmXMLWriter& xml, std::chrono::duration<double> elapsed_build_time)
{
xml.StartElement("Log");
xml.Attribute("Encoding", "base64");
@@ -643,8 +645,10 @@ void cmCTestBuildHandler::GenerateXMLFooter(cmXMLWriter& xml,
xml.Element("EndDateTime", this->EndBuild);
xml.Element("EndBuildTime", static_cast<unsigned int>(this->EndBuildTime));
- xml.Element("ElapsedMinutes",
- static_cast<int>(elapsed_build_time / 6) / 10.0);
+ xml.Element(
+ "ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(elapsed_build_time)
+ .count());
xml.EndElement(); // Build
this->CTest->EndXML(xml);
}
diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h
index 6e71ad6..9a29d6d 100644
--- a/Source/CTest/cmCTestBuildHandler.h
+++ b/Source/CTest/cmCTestBuildHandler.h
@@ -9,6 +9,7 @@
#include "cmProcessOutput.h"
#include "cmsys/RegularExpression.hxx"
+#include <chrono>
#include <deque>
#include <iosfwd>
#include <stddef.h>
@@ -86,7 +87,8 @@ private:
void GenerateXMLHeader(cmXMLWriter& xml);
void GenerateXMLLaunched(cmXMLWriter& xml);
void GenerateXMLLogScraped(cmXMLWriter& xml);
- void GenerateXMLFooter(cmXMLWriter& xml, double elapsed_build_time);
+ void GenerateXMLFooter(cmXMLWriter& xml,
+ std::chrono::duration<double> elapsed_build_time);
bool IsLaunchedErrorFile(const char* fname);
bool IsLaunchedWarningFile(const char* fname);
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
index 56a038e..e732f9f 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -7,8 +7,10 @@
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
+#include <chrono>
#include <ostream>
#include <string>
+#include <type_traits>
cmCTestConfigureHandler::cmCTestConfigureHandler()
{
@@ -43,7 +45,7 @@ int cmCTestConfigureHandler::ProcessHandler()
return -1;
}
- double elapsed_time_start = cmSystemTools::GetTime();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
std::string output;
int retVal = 0;
int res = 0;
@@ -84,10 +86,10 @@ int cmCTestConfigureHandler::ProcessHandler()
xml.Element("EndDateTime", this->CTest->CurrentTime());
xml.Element("EndConfigureTime",
static_cast<unsigned int>(cmSystemTools::GetTime()));
- xml.Element(
- "ElapsedMinutes",
- static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start) / 6) /
- 10.0);
+ xml.Element("ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(
+ std::chrono::steady_clock::now() - elapsed_time_start)
+ .count());
xml.EndElement(); // Configure
this->CTest->EndXML(xml);
}
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 56eeceb..85f6ce9 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -21,11 +21,13 @@
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
#include <algorithm>
+#include <chrono>
#include <iomanip>
#include <iterator>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
+#include <type_traits>
#include <utility>
class cmMakefile;
@@ -290,13 +292,14 @@ int cmCTestCoverageHandler::ProcessHandler()
this->LoadLabels();
cmGeneratedFileStream ofs;
- double elapsed_time_start = cmSystemTools::GetTime();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
if (!this->StartLogFile("Coverage", ofs)) {
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Cannot create LastCoverage.log file" << std::endl);
}
- ofs << "Performing coverage: " << elapsed_time_start << std::endl;
+ ofs << "Performing coverage: "
+ << elapsed_time_start.time_since_epoch().count() << std::endl;
this->CleanCoverageLogFiles(ofs);
cmSystemTools::ConvertToUnixSlashes(sourceDir);
@@ -621,10 +624,10 @@ int cmCTestCoverageHandler::ProcessHandler()
covSumXML.Element("EndDateTime", end_time);
covSumXML.Element("EndTime",
static_cast<unsigned int>(cmSystemTools::GetTime()));
- covSumXML.Element(
- "ElapsedMinutes",
- static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start) / 6) /
- 10.0);
+ covSumXML.Element("ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(
+ std::chrono::steady_clock::now() - elapsed_time_start)
+ .count());
covSumXML.EndElement(); // Coverage
this->CTest->EndXML(covSumXML);
@@ -1963,7 +1966,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
return 0;
}
this->CTest->StartXML(xml, this->AppendXML);
- double elapsed_time_start = cmSystemTools::GetTime();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
std::string coverage_start_time = this->CTest->CurrentTime();
xml.StartElement("Coverage");
xml.Element("StartDateTime", coverage_start_time);
@@ -2090,10 +2093,10 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
xml.Element("PercentCoverage", SAFEDIV(percent_coverage, number_files));
xml.Element("EndDateTime", end_time);
xml.Element("EndTime", static_cast<unsigned int>(cmSystemTools::GetTime()));
- xml.Element(
- "ElapsedMinutes",
- static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start) / 6) /
- 10.0);
+ xml.Element("ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(
+ std::chrono::steady_clock::now() - elapsed_time_start)
+ .count());
xml.EndElement(); // Coverage
this->CTest->EndXML(xml);
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 3efb039..2e7874d 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -10,9 +10,11 @@
#include "cmsys/FStream.hxx"
#include "cmsys/Glob.hxx"
#include "cmsys/RegularExpression.hxx"
+#include <chrono>
#include <iostream>
#include <sstream>
#include <string.h>
+#include <type_traits>
struct CatToErrorType
{
@@ -408,8 +410,10 @@ void cmCTestMemCheckHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.Element("EndDateTime", this->EndTest);
xml.Element("EndTestTime", this->EndTestTime);
- xml.Element("ElapsedMinutes",
- static_cast<int>(this->ElapsedTestingTime / 6) / 10.0);
+ xml.Element(
+ "ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(this->ElapsedTestingTime)
+ .count());
xml.EndElement(); // DynamicAnalysis
this->CTest->EndXML(xml);
@@ -844,7 +848,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
cmsys::RegularExpression vgABR("== .*pthread_mutex_unlock: mutex is "
"locked by a different thread");
std::vector<std::string::size_type> nonValGrindOutput;
- double sttime = cmSystemTools::GetTime();
+ auto sttime = std::chrono::steady_clock::now();
cmCTestOptionalLog(this->CTest, DEBUG,
"Start test: " << lines.size() << std::endl, this->Quiet);
std::string::size_type totalOutputSize = 0;
@@ -918,7 +922,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
}
}
cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: "
- << (cmSystemTools::GetTime() - sttime) << std::endl,
+ << std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::steady_clock::now() - sttime)
+ .count()
+ << "s)" << std::endl,
this->Quiet);
log = ostr.str();
this->DefectCount += defects;
@@ -929,7 +936,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
const std::string& str, std::string& log, std::vector<int>& results)
{
log.clear();
- double sttime = cmSystemTools::GetTime();
+ auto sttime = std::chrono::steady_clock::now();
std::vector<std::string> lines;
cmSystemTools::Split(str.c_str(), lines);
cmCTestOptionalLog(this->CTest, DEBUG,
@@ -961,7 +968,10 @@ bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
defects++;
}
cmCTestOptionalLog(this->CTest, DEBUG, "End test (elapsed: "
- << (cmSystemTools::GetTime() - sttime) << std::endl,
+ << std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::steady_clock::now() - sttime)
+ .count()
+ << "s)" << std::endl,
this->Quiet);
if (defects) {
// only put the output of Bounds Checker if there were
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index abdb643..99531af 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -14,6 +14,7 @@
#include "cmsys/Base64.h"
#include "cmsys/Process.h"
#include "cmsys/RegularExpression.hxx"
+#include <chrono>
#include <iomanip>
#include <sstream>
#include <stdio.h>
@@ -46,11 +47,12 @@ cmCTestRunTest::~cmCTestRunTest()
bool cmCTestRunTest::CheckOutput()
{
// Read lines for up to 0.1 seconds of total time.
- double timeout = 0.1;
- double timeEnd = cmSystemTools::GetTime() + timeout;
+ std::chrono::duration<double> timeout = std::chrono::milliseconds(100);
+ auto timeEnd = std::chrono::steady_clock::now() + timeout;
std::string line;
- while ((timeout = timeEnd - cmSystemTools::GetTime(), timeout > 0)) {
- int p = this->TestProcess->GetNextOutputLine(line, timeout);
+ while ((timeout = timeEnd - std::chrono::steady_clock::now(),
+ timeout > std::chrono::seconds(0))) {
+ int p = this->TestProcess->GetNextOutputLine(line, timeout.count());
if (p == cmsysProcess_Pipe_None) {
// Process has terminated and all output read.
return false;
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 198f6e5..3bf27a0 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -5,10 +5,12 @@
#include "cmsys/Directory.hxx"
#include "cmsys/Process.h"
#include <map>
+#include <ratio>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <type_traits>
#include <utility>
#include "cmCTest.h"
@@ -79,7 +81,7 @@ cmCTestScriptHandler::cmCTestScriptHandler()
this->CMake = nullptr;
this->GlobalGenerator = nullptr;
- this->ScriptStartTime = 0;
+ this->ScriptStartTime = std::chrono::steady_clock::time_point();
// the *60 is because the settings are in minutes but GetTime is seconds
this->MinimumInterval = 30 * 60;
@@ -111,7 +113,7 @@ void cmCTestScriptHandler::Initialize()
this->ContinuousDuration = -1;
// what time in seconds did this script start running
- this->ScriptStartTime = 0;
+ this->ScriptStartTime = std::chrono::steady_clock::time_point();
delete this->Makefile;
this->Makefile = nullptr;
@@ -158,11 +160,10 @@ void cmCTestScriptHandler::UpdateElapsedTime()
{
if (this->Makefile) {
// set the current elapsed time
- char timeString[20];
- int itime = static_cast<unsigned int>(cmSystemTools::GetTime() -
- this->ScriptStartTime);
- sprintf(timeString, "%i", itime);
- this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString);
+ auto itime = std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::steady_clock::now() - this->ScriptStartTime);
+ auto timeString = std::to_string(itime.count());
+ this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString.c_str());
}
}
@@ -507,7 +508,7 @@ int cmCTestScriptHandler::RunConfigurationScript(
int result;
- this->ScriptStartTime = cmSystemTools::GetTime();
+ this->ScriptStartTime = std::chrono::steady_clock::now();
// read in the script
if (pscope) {
@@ -558,22 +559,27 @@ int cmCTestScriptHandler::RunCurrentScript()
// for a continuous, do we ned to run it more than once?
if (this->ContinuousDuration >= 0) {
this->UpdateElapsedTime();
- double ending_time = cmSystemTools::GetTime() + this->ContinuousDuration;
+ auto ending_time = std::chrono::steady_clock::now() +
+ std::chrono::duration<double>(this->ContinuousDuration);
if (this->EmptyBinDirOnce) {
this->EmptyBinDir = true;
}
do {
- double interval = cmSystemTools::GetTime();
+ auto startOfInterval = std::chrono::steady_clock::now();
result = this->RunConfigurationDashboard();
- interval = cmSystemTools::GetTime() - interval;
- if (interval < this->MinimumInterval) {
- this->SleepInSeconds(
- static_cast<unsigned int>(this->MinimumInterval - interval));
+ auto interval = std::chrono::steady_clock::now() - startOfInterval;
+ auto minimumInterval =
+ std::chrono::duration<double>(this->MinimumInterval);
+ if (interval < minimumInterval) {
+ auto sleepTime = std::chrono::duration_cast<std::chrono::seconds>(
+ minimumInterval - interval)
+ .count();
+ this->SleepInSeconds(static_cast<unsigned int>(sleepTime));
}
if (this->EmptyBinDirOnce) {
this->EmptyBinDir = false;
}
- } while (cmSystemTools::GetTime() < ending_time);
+ } while (std::chrono::steady_clock::now() < ending_time);
}
// otherwise just run it once
else {
@@ -967,7 +973,9 @@ double cmCTestScriptHandler::GetRemainingTimeAllowed()
return 1.0e7;
}
- double timelimit = atof(timelimitS);
+ auto timelimit = std::chrono::duration<double>(atof(timelimitS));
- return timelimit - cmSystemTools::GetTime() + this->ScriptStartTime;
+ auto duration = std::chrono::duration_cast<std::chrono::duration<double>>(
+ std::chrono::steady_clock::now() - this->ScriptStartTime);
+ return (timelimit - duration).count();
}
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index b6cd97b..2090d04 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -7,6 +7,7 @@
#include "cmCTestGenericHandler.h"
+#include <chrono>
#include <string>
#include <vector>
@@ -104,6 +105,7 @@ public:
void CreateCMake();
cmake* GetCMake() { return this->CMake; }
+
private:
// reads in a script
int ReadInScript(const std::string& total_script_arg);
@@ -156,7 +158,7 @@ private:
double ContinuousDuration;
// what time in seconds did this script start running
- double ScriptStartTime;
+ std::chrono::steady_clock::time_point ScriptStartTime;
cmMakefile* Makefile;
cmGlobalGenerator* GlobalGenerator;
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 719688c..6534fd1 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -6,6 +6,7 @@
#include "cm_jsoncpp_reader.h"
#include "cm_jsoncpp_value.h"
#include "cmsys/Process.h"
+#include <chrono>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
@@ -496,10 +497,11 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
? ""
: this->GetOption("RetryCount");
- int delay = retryDelay.empty()
- ? atoi(this->CTest->GetCTestConfiguration("CTestSubmitRetryDelay")
- .c_str())
- : atoi(retryDelay.c_str());
+ auto delay = std::chrono::duration<double>(
+ retryDelay.empty()
+ ? atoi(this->CTest->GetCTestConfiguration("CTestSubmitRetryDelay")
+ .c_str())
+ : atoi(retryDelay.c_str()));
int count = retryCount.empty()
? atoi(this->CTest->GetCTestConfiguration("CTestSubmitRetryCount")
.c_str())
@@ -507,12 +509,12 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
for (int i = 0; i < count; i++) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Submit failed, waiting " << delay
+ " Submit failed, waiting " << delay.count()
<< " seconds...\n",
this->Quiet);
- double stop = cmSystemTools::GetTime() + delay;
- while (cmSystemTools::GetTime() < stop) {
+ auto stop = std::chrono::steady_clock::now() + delay;
+ while (std::chrono::steady_clock::now() < stop) {
cmSystemTools::Delay(100);
}
@@ -1031,11 +1033,15 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
std::string retryCountString = this->GetOption("RetryCount") == nullptr
? ""
: this->GetOption("RetryCount");
- unsigned long retryDelay = 0;
+ auto retryDelay = std::chrono::seconds(0);
if (!retryDelayString.empty()) {
- if (!cmSystemTools::StringToULong(retryDelayString.c_str(), &retryDelay)) {
+ unsigned long retryDelayValue = 0;
+ if (!cmSystemTools::StringToULong(retryDelayString.c_str(),
+ &retryDelayValue)) {
cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : "
<< retryDelayString << std::endl);
+ } else {
+ retryDelay = std::chrono::seconds(retryDelayValue);
}
}
unsigned long retryCount = 0;
@@ -1087,12 +1093,12 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
// If request failed, wait and retry.
for (unsigned long i = 0; i < retryCount; i++) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Request failed, waiting " << retryDelay
+ " Request failed, waiting " << retryDelay.count()
<< " seconds...\n",
this->Quiet);
- double stop = cmSystemTools::GetTime() + static_cast<double>(retryDelay);
- while (cmSystemTools::GetTime() < stop) {
+ auto stop = std::chrono::steady_clock::now() + retryDelay;
+ while (std::chrono::steady_clock::now() < stop) {
cmSystemTools::Delay(100);
}
@@ -1161,12 +1167,12 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file,
// If upload failed, wait and retry.
for (unsigned long i = 0; i < retryCount; i++) {
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
- " Upload failed, waiting " << retryDelay
+ " Upload failed, waiting " << retryDelay.count()
<< " seconds...\n",
this->Quiet);
- double stop = cmSystemTools::GetTime() + static_cast<double>(retryDelay);
- while (cmSystemTools::GetTime() < stop) {
+ auto stop = std::chrono::steady_clock::now() + retryDelay;
+ while (std::chrono::steady_clock::now() < stop) {
cmSystemTools::Delay(100);
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index c7ed927..b814e35 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestTestHandler.h"
#include <algorithm>
+#include <chrono>
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
#include <cmsys/RegularExpression.hxx>
@@ -15,6 +16,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <type_traits>
#include "cmAlgorithms.h"
#include "cmCTest.h"
@@ -346,7 +348,7 @@ void cmCTestTestHandler::Initialize()
{
this->Superclass::Initialize();
- this->ElapsedTestingTime = -1;
+ this->ElapsedTestingTime = std::chrono::duration<double>();
this->TestResults.clear();
@@ -484,12 +486,11 @@ int cmCTestTestHandler::ProcessHandler()
int total;
// start the real time clock
- double clock_start, clock_finish;
- clock_start = cmSystemTools::GetTime();
+ auto clock_start = std::chrono::steady_clock::now();
this->ProcessDirectory(passed, failed);
- clock_finish = cmSystemTools::GetTime();
+ auto clock_finish = std::chrono::steady_clock::now();
total = int(passed.size()) + int(failed.size());
@@ -540,7 +541,10 @@ int cmCTestTestHandler::ProcessHandler()
this->PrintLabelOrSubprojectSummary(false);
}
char realBuf[1024];
- sprintf(realBuf, "%6.2f sec", clock_finish - clock_start);
+ auto durationInMs = std::chrono::duration_cast<std::chrono::milliseconds>(
+ clock_finish - clock_start)
+ .count();
+ sprintf(realBuf, "%6.2f sec", static_cast<double>(durationInMs) / 1000.0);
cmCTestOptionalLog(this->CTest, HANDLER_OUTPUT,
"\nTotal Test time (real) = " << realBuf << "\n",
this->Quiet);
@@ -1201,7 +1205,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
this->ComputeTestList();
this->StartTest = this->CTest->CurrentTime();
this->StartTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
- double elapsed_time_start = cmSystemTools::GetTime();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
cmCTestMultiProcessHandler* parallel = this->CTest->GetBatchJobs()
? new cmCTestBatchTestHandler
@@ -1268,7 +1272,8 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string>& passed,
delete parallel;
this->EndTest = this->CTest->CurrentTime();
this->EndTestTime = static_cast<unsigned int>(cmSystemTools::GetTime());
- this->ElapsedTestingTime = cmSystemTools::GetTime() - elapsed_time_start;
+ this->ElapsedTestingTime =
+ std::chrono::steady_clock::now() - elapsed_time_start;
*this->LogFile << "End testing: " << this->CTest->CurrentTime() << std::endl;
}
@@ -1373,8 +1378,10 @@ void cmCTestTestHandler::GenerateDartOutput(cmXMLWriter& xml)
xml.Element("EndDateTime", this->EndTest);
xml.Element("EndTestTime", this->EndTestTime);
- xml.Element("ElapsedMinutes",
- static_cast<int>(this->ElapsedTestingTime / 6) / 10.0);
+ xml.Element(
+ "ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(this->ElapsedTestingTime)
+ .count());
xml.EndElement(); // Testing
this->CTest->EndXML(xml);
}
diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h
index 620e906..af85e72 100644
--- a/Source/CTest/cmCTestTestHandler.h
+++ b/Source/CTest/cmCTestTestHandler.h
@@ -8,6 +8,7 @@
#include "cmCTestGenericHandler.h"
#include "cmsys/RegularExpression.hxx"
+#include <chrono>
#include <iosfwd>
#include <map>
#include <set>
@@ -198,7 +199,7 @@ protected:
//! Clean test output to specified length
bool CleanTestOutput(std::string& output, size_t length);
- double ElapsedTestingTime;
+ std::chrono::duration<double> ElapsedTestingTime;
typedef std::vector<cmCTestTestResult> TestResultsVector;
TestResultsVector TestResults;
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 786ed5e..2bd0253 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -17,8 +17,10 @@
#include "cmVersion.h"
#include "cmXMLWriter.h"
+#include <chrono>
#include <memory> // IWYU pragma: keep
#include <sstream>
+#include <type_traits>
static const char* cmCTestUpdateHandlerUpdateStrings[] = {
"Unknown", "CVS", "SVN", "BZR", "GIT", "HG", "P4"
@@ -177,7 +179,7 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string start_time = this->CTest->CurrentTime();
unsigned int start_time_time =
static_cast<unsigned int>(cmSystemTools::GetTime());
- double elapsed_time_start = cmSystemTools::GetTime();
+ auto elapsed_time_start = std::chrono::steady_clock::now();
bool updated = vc->Update();
std::string buildname =
@@ -225,10 +227,10 @@ int cmCTestUpdateHandler::ProcessHandler()
std::string end_time = this->CTest->CurrentTime();
xml.Element("EndDateTime", end_time);
xml.Element("EndTime", static_cast<unsigned int>(cmSystemTools::GetTime()));
- xml.Element(
- "ElapsedMinutes",
- static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start) / 6) /
- 10.0);
+ xml.Element("ElapsedMinutes",
+ std::chrono::duration_cast<std::chrono::minutes>(
+ std::chrono::steady_clock::now() - elapsed_time_start)
+ .count());
xml.StartElement("UpdateReturnStatus");
if (localModifications) {
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index f3c191b..78dd598 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -3,8 +3,8 @@
#include "cmProcess.h"
#include "cmProcessOutput.h"
-#include "cmSystemTools.h"
#include <iostream>
+#include <type_traits>
cmProcess::cmProcess()
{
@@ -13,7 +13,7 @@ cmProcess::cmProcess()
this->TotalTime = 0;
this->ExitValue = 0;
this->Id = 0;
- this->StartTime = 0;
+ this->StartTime = std::chrono::steady_clock::time_point();
}
cmProcess::~cmProcess()
@@ -35,7 +35,7 @@ bool cmProcess::StartProcess()
if (this->Command.empty()) {
return false;
}
- this->StartTime = cmSystemTools::GetTime();
+ this->StartTime = std::chrono::steady_clock::now();
this->ProcessArgs.clear();
// put the command as arg0
this->ProcessArgs.push_back(this->Command.c_str());
@@ -143,7 +143,11 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
// Record exit information.
this->ExitValue = cmsysProcess_GetExitValue(this->Process);
- this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
+ this->TotalTime =
+ static_cast<double>(std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::steady_clock::now() - this->StartTime)
+ .count()) /
+ 1000.0;
// Because of a processor clock scew the runtime may become slightly
// negative. If someone changed the system clock while the process was
// running this may be even more. Make sure not to report a negative
@@ -231,7 +235,7 @@ void cmProcess::ChangeTimeout(double t)
void cmProcess::ResetStartTime()
{
cmsysProcess_ResetStartTime(this->Process);
- this->StartTime = cmSystemTools::GetTime();
+ this->StartTime = std::chrono::steady_clock::now();
}
int cmProcess::GetExitException()
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index dfb02fe..ddd69b6 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmsys/Process.h"
+#include <chrono>
#include <string>
#include <vector>
@@ -50,7 +51,7 @@ public:
private:
double Timeout;
- double StartTime;
+ std::chrono::steady_clock::time_point StartTime;
double TotalTime;
cmsysProcess* Process;
class Buffer : public std::vector<char>
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index a31e415..b3e3393 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -489,7 +489,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
char const* sourceFullPath = (*si)->GetFullPath().c_str();
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
- std::string sgPath(sourceGroup->GetFullName());
+ std::string sgPath = sourceGroup->GetFullName();
cmSystemTools::ConvertToUnixSlashes(sgPath);
cmGlobalGhsMultiGenerator::AddFilesUpToPath(
this->GetFolderBuildStreams(), &this->FolderBuildStreams,
@@ -608,7 +608,7 @@ std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
cmSourceGroup* sourceGroup =
localGhsMultiGenerator->GetMakefile()->FindSourceGroup(sourceFullPath,
sourceGroups);
- std::string const sgPath(sourceGroup->GetFullName());
+ std::string const& sgPath = sourceGroup->GetFullName();
dir_max += sgPath;
dir_max += "/Objs/libs/";
dir_max += generatorTarget->Target->GetName();
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index dfc1bed..41fe5d2 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2797,13 +2797,13 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateOrGetPBXGroup(
// If it's the default source group (empty name) then put the source file
// directly in the tgroup...
//
- if (std::string(sg->GetFullName()).empty()) {
+ if (sg->GetFullName().empty()) {
this->GroupNameMap[s] = tgroup;
return tgroup;
}
// It's a recursive folder structure, let's find the real parent group
- if (std::string(sg->GetFullName()) != std::string(sg->GetName())) {
+ if (sg->GetFullName() != sg->GetName()) {
std::string curr_folder = target;
curr_folder += "/";
for (auto const& folder :
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index beb80f2..f01ed7a 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1600,7 +1600,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
}
// If the group has a name, write the header.
- std::string name = sg->GetName();
+ std::string const& name = sg->GetName();
if (!name.empty()) {
this->WriteVCProjBeginGroup(fout, name.c_str(), "");
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c642db7..0855e79 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1950,7 +1950,7 @@ cmSourceGroup* cmMakefile::GetSourceGroup(
// first look for source group starting with the same as the one we want
for (cmSourceGroup const& srcGroup : this->SourceGroups) {
- std::string sgName = srcGroup.GetName();
+ std::string const& sgName = srcGroup.GetName();
if (sgName == name[0]) {
sg = const_cast<cmSourceGroup*>(&srcGroup);
break;
@@ -2014,7 +2014,8 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name,
}
// build the whole source group path
for (++i; i <= lastElement; ++i) {
- sg->AddChild(cmSourceGroup(name[i].c_str(), nullptr, sg->GetFullName()));
+ sg->AddChild(
+ cmSourceGroup(name[i].c_str(), nullptr, sg->GetFullName().c_str()));
sg = sg->LookupChild(name[i].c_str());
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index f614dca..c39f927 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -211,7 +211,10 @@ class cmMakefile;
"Define file(GENERATE) behavior for relative paths.", 3, 10, 0, \
cmPolicies::WARN) \
SELECT(POLICY, CMP0071, "Let AUTOMOC and AUTOUIC process GENERATED files.", \
- 3, 10, 0, cmPolicies::WARN)
+ 3, 10, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0072, \
+ "FindOpenGL prefers GLVND by default when available.", 3, 11, 0, \
+ cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 07df488..aae0a9d 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -1118,11 +1118,24 @@ static Json::Value DumpProjectList(const cmake* cm, std::string const& config)
const cmMakefile* mf = lg->GetMakefile();
pObj[kMINIMUM_CMAKE_VERSION] =
mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");
- pObj[kHAS_INSTALL_RULE] = mf->GetInstallGenerators().empty() == false;
pObj[kSOURCE_DIRECTORY_KEY] = mf->GetCurrentSourceDirectory();
pObj[kBUILD_DIRECTORY_KEY] = mf->GetCurrentBinaryDirectory();
pObj[kTARGETS_KEY] = DumpTargetsList(projectIt.second, config);
+ // For a project-level install rule it might be defined in any of its
+ // associated generators.
+ bool hasInstallRule = false;
+ for (const auto generator : projectIt.second) {
+ hasInstallRule =
+ generator->GetMakefile()->GetInstallGenerators().empty() == false;
+
+ if (hasInstallRule) {
+ break;
+ }
+ }
+
+ pObj[kHAS_INSTALL_RULE] = hasInstallRule;
+
result.append(pObj);
}
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index fba4c31..18bcb49 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -60,14 +60,14 @@ void cmSourceGroup::AddGroupFile(const std::string& name)
this->GroupFiles.insert(name);
}
-const char* cmSourceGroup::GetName() const
+std::string const& cmSourceGroup::GetName() const
{
- return this->Name.c_str();
+ return this->Name;
}
-const char* cmSourceGroup::GetFullName() const
+std::string const& cmSourceGroup::GetFullName() const
{
- return this->FullName.c_str();
+ return this->FullName;
}
bool cmSourceGroup::MatchesRegex(const char* name)
@@ -105,7 +105,7 @@ cmSourceGroup* cmSourceGroup::LookupChild(const char* name) const
// st
for (; iter != end; ++iter) {
- std::string sgName = iter->GetName();
+ std::string const& sgName = iter->GetName();
// look if descenened is the one were looking for
if (sgName == name) {
diff --git a/Source/cmSourceGroup.h b/Source/cmSourceGroup.h
index e8bd697..7c7c35f 100644
--- a/Source/cmSourceGroup.h
+++ b/Source/cmSourceGroup.h
@@ -55,12 +55,12 @@ public:
/**
* Get the name of this group.
*/
- const char* GetName() const;
+ std::string const& GetName() const;
/**
* Get the full path name for group.
*/
- const char* GetFullName() const;
+ std::string const& GetFullName() const;
/**
* Check if the given name matches this group's regex.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6486c8b..caeeeb9 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1469,11 +1469,14 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
}
this->WriteString("<ItemGroup>\n", 1);
- for (std::set<cmSourceGroup*>::iterator g = groupsUsed.begin();
- g != groupsUsed.end(); ++g) {
- cmSourceGroup* sg = *g;
- const char* name = sg->GetFullName();
- if (strlen(name) != 0) {
+ std::vector<cmSourceGroup*> groupsVec(groupsUsed.begin(), groupsUsed.end());
+ std::sort(groupsVec.begin(), groupsVec.end(),
+ [](cmSourceGroup* l, cmSourceGroup* r) {
+ return l->GetFullName() < r->GetFullName();
+ });
+ for (cmSourceGroup* sg : groupsVec) {
+ std::string const& name = sg->GetFullName();
+ if (!name.empty()) {
this->WriteString("<Filter Include=\"", 2);
(*this->BuildFileStream) << name << "\">\n";
std::string guidName = "SG_Filter_";
@@ -1558,12 +1561,12 @@ void cmVisualStudio10TargetGenerator::WriteGroupSources(
std::string const& source = sf->GetFullPath();
cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
- const char* filter = sourceGroup->GetFullName();
+ std::string const& filter = sourceGroup->GetFullName();
this->WriteString("<", 2);
std::string path = this->ConvertPath(source, s->RelativePath);
this->ConvertToWindowsSlash(path);
(*this->BuildFileStream) << name << " Include=\"" << cmVS10EscapeXML(path);
- if (strlen(filter)) {
+ if (!filter.empty()) {
(*this->BuildFileStream) << "\">\n";
this->WriteString("<Filter>", 3);
(*this->BuildFileStream) << filter << "</Filter>\n";