diff options
author | Brad King <brad.king@kitware.com> | 2019-07-26 11:29:19 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-07-26 11:32:18 (GMT) |
commit | 467e6ac728cefa484f9e9369a7da4d05b04ec403 (patch) | |
tree | a5a22d30ca5ab813f3f8f4db40144a132005a68f /Source/CTest | |
parent | c23c4ed9cf912e265e1070507905b3dbc495a210 (diff) | |
parent | e91bfe440c1419b445ef6746552dd03ba302e6cf (diff) | |
download | CMake-467e6ac728cefa484f9e9369a7da4d05b04ec403.zip CMake-467e6ac728cefa484f9e9369a7da4d05b04ec403.tar.gz CMake-467e6ac728cefa484f9e9369a7da4d05b04ec403.tar.bz2 |
Merge topic 'definitions_string_view'
e91bfe440c cmMakefile: Let AddDefinition accept a value as cm::string_view
f2ba968ef2 cmMakefile: Simplify and rename AddDefinitionBool
9b5cc42531 cmDefinitions: Remove const char* based Set method
e268840c0a cmDefinitions: Add Unset and cm::string_view based Set methods
451fd329a8 cmDefinitions: Cleanups
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3577
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestBuildCommand.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestHandlerCommand.cxx | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckCommand.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunScriptCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 20 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitCommand.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 3 |
7 files changed, 17 insertions, 22 deletions
diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 2eacaf1..e71eafe 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -156,15 +156,14 @@ bool cmCTestBuildCommand::InitialPass(std::vector<std::string> const& args, if (this->Values[ctb_NUMBER_ERRORS] && *this->Values[ctb_NUMBER_ERRORS]) { std::ostringstream str; str << this->Handler->GetTotalErrors(); - this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS], - str.str().c_str()); + this->Makefile->AddDefinition(this->Values[ctb_NUMBER_ERRORS], str.str()); } if (this->Values[ctb_NUMBER_WARNINGS] && *this->Values[ctb_NUMBER_WARNINGS]) { std::ostringstream str; str << this->Handler->GetTotalWarnings(); this->Makefile->AddDefinition(this->Values[ctb_NUMBER_WARNINGS], - str.str().c_str()); + str.str()); } return ret; } diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 381b41e..8ceca08 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -230,8 +230,7 @@ bool cmCTestHandlerCommand::InitialPass(std::vector<std::string> const& args, if (this->Values[ct_RETURN_VALUE] && *this->Values[ct_RETURN_VALUE]) { std::ostringstream str; str << res; - this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE], - str.str().c_str()); + this->Makefile->AddDefinition(this->Values[ct_RETURN_VALUE], str.str()); } this->ProcessAdditionalValues(handler); // log the error message if there was an error diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx index 7dad1ce..d7d42bf 100644 --- a/Source/CTest/cmCTestMemCheckCommand.cxx +++ b/Source/CTest/cmCTestMemCheckCommand.cxx @@ -3,7 +3,6 @@ #include "cmCTestMemCheckCommand.h" #include <sstream> -#include <string> #include <vector> #include "cmCTest.h" @@ -47,7 +46,6 @@ void cmCTestMemCheckCommand::ProcessAdditionalValues( if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) { std::ostringstream str; str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount(); - this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], - str.str().c_str()); + this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], str.str()); } } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index a7e47d3..c03cffd 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -43,7 +43,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args, args[i].c_str(), !np, &ret); std::ostringstream str; str << ret; - this->Makefile->AddDefinition(returnVariable, str.str().c_str()); + this->Makefile->AddDefinition(returnVariable, str.str()); } } return true; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 85040dd..7a5b8d1 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -168,7 +168,7 @@ void cmCTestScriptHandler::UpdateElapsedTime() auto itime = cmDurationTo<unsigned int>(std::chrono::steady_clock::now() - this->ScriptStartTime); auto timeString = std::to_string(itime); - this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString.c_str()); + this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString); } } @@ -352,21 +352,21 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->CreateCMake(); // set a variable with the path to the current script - this->Makefile->AddDefinition( - "CTEST_SCRIPT_DIRECTORY", cmSystemTools::GetFilenamePath(script).c_str()); - this->Makefile->AddDefinition( - "CTEST_SCRIPT_NAME", cmSystemTools::GetFilenameName(script).c_str()); + this->Makefile->AddDefinition("CTEST_SCRIPT_DIRECTORY", + cmSystemTools::GetFilenamePath(script)); + this->Makefile->AddDefinition("CTEST_SCRIPT_NAME", + cmSystemTools::GetFilenameName(script)); this->Makefile->AddDefinition("CTEST_EXECUTABLE_NAME", - cmSystemTools::GetCTestCommand().c_str()); + cmSystemTools::GetCTestCommand()); this->Makefile->AddDefinition("CMAKE_EXECUTABLE_NAME", - cmSystemTools::GetCMakeCommand().c_str()); - this->Makefile->AddDefinition("CTEST_RUN_CURRENT_SCRIPT", true); + cmSystemTools::GetCMakeCommand()); + this->Makefile->AddDefinitionBool("CTEST_RUN_CURRENT_SCRIPT", true); this->SetRunCurrentScript(true); this->UpdateElapsedTime(); // add the script arg if defined if (!script_arg.empty()) { - this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str()); + this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg); } #if defined(__CYGWIN__) @@ -398,7 +398,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) const std::map<std::string, std::string>& defs = this->CTest->GetDefinitions(); for (auto const& d : defs) { - this->Makefile->AddDefinition(d.first, d.second.c_str()); + this->Makefile->AddDefinition(d.first, d.second); } // finally read in the script diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index bf43d88..58c0a1b 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -143,7 +143,7 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args, if (this->Values[cts_BUILD_ID] && *this->Values[cts_BUILD_ID]) { this->Makefile->AddDefinition(this->Values[cts_BUILD_ID], - this->CTest->GetBuildID().c_str()); + this->CTest->GetBuildID()); } return ret; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index cfbdad0..5134407 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1714,8 +1714,7 @@ void cmCTestTestHandler::GetListOfTests() cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); cmMakefile mf(&gg, cm.GetCurrentSnapshot()); - mf.AddDefinition("CTEST_CONFIGURATION_TYPE", - this->CTest->GetConfigType().c_str()); + mf.AddDefinition("CTEST_CONFIGURATION_TYPE", this->CTest->GetConfigType()); // Add handler for ADD_TEST auto newCom1 = cm::make_unique<cmCTestAddTestCommand>(); |