diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmExecProgramCommand.cxx | 30 | ||||
-rw-r--r-- | Source/cmExecProgramCommand.h | 2 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 9 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 13 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.h | 3 | ||||
-rw-r--r-- | Source/cmGraphVizWriter.cxx | 26 | ||||
-rw-r--r-- | Source/cmGraphVizWriter.h | 10 | ||||
-rw-r--r-- | Source/cmHexFileConverter.cxx | 6 | ||||
-rw-r--r-- | Source/cmHexFileConverter.h | 6 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 27 | ||||
-rw-r--r-- | Source/cmUseMangledMesaCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmUseMangledMesaCommand.h | 3 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 16 | ||||
-rw-r--r-- | Source/cmake.cxx | 13 | ||||
-rw-r--r-- | Source/cmake.h | 4 |
16 files changed, 100 insertions, 82 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 63d5f3d..e226579 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 14) -set(CMake_VERSION_PATCH 20190520) +set(CMake_VERSION_PATCH 20190522) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 36651af..4b559e7 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -82,11 +82,11 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args, bool result = true; if (args.size() - count == 2) { cmSystemTools::MakeDirectory(args[1]); - result = cmExecProgramCommand::RunCommand(command.c_str(), output, retVal, + result = cmExecProgramCommand::RunCommand(command, output, retVal, args[1].c_str(), verbose); } else { - result = cmExecProgramCommand::RunCommand(command.c_str(), output, retVal, - nullptr, verbose); + result = cmExecProgramCommand::RunCommand(command, output, retVal, nullptr, + verbose); } if (!result) { retVal = -1; @@ -115,7 +115,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args, return true; } -bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, +bool cmExecProgramCommand::RunCommand(std::string command, std::string& output, int& retVal, const char* dir, bool verbose, Encoding encoding) { @@ -128,12 +128,11 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, // try to find the program, and if the program can not be // found use system to run the command as it must be a built in // shell command like echo or dir - int count = 0; - std::string shortCmd; - if (command[0] == '\"') { + if (!command.empty() && command[0] == '\"') { // count the number of quotes - for (const char* s = command; *s != 0; ++s) { - if (*s == '\"') { + int count = 0; + for (char c : command) { + if (c == '\"') { count++; if (count > 2) { break; @@ -147,20 +146,21 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, if (count > 2) { cmsys::RegularExpression quoted("^\"([^\"]*)\"[ \t](.*)"); if (quoted.find(command)) { + std::string shortCmd; std::string cmd = quoted.match(1); std::string args = quoted.match(2); if (!cmSystemTools::FileExists(cmd)) { shortCmd = cmd; - } else if (!cmSystemTools::GetShortPath(cmd.c_str(), shortCmd)) { + } else if (!cmSystemTools::GetShortPath(cmd, shortCmd)) { cmSystemTools::Error("GetShortPath failed for " + cmd); return false; } shortCmd += " "; shortCmd += args; - command = shortCmd.c_str(); + command = shortCmd; } else { - cmSystemTools::Error("Could not parse command line with quotes ", + cmSystemTools::Error("Could not parse command line with quotes " + command); } } @@ -182,7 +182,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, cmsysProcess_SetOption(cp, cmsysProcess_Option_HideWindow, 1); } cmsysProcess_SetOption(cp, cmsysProcess_Option_Verbatim, 1); - const char* cmd[] = { command, 0 }; + const char* cmd[] = { command.c_str(), nullptr }; cmsysProcess_SetCommand(cp, cmd); #else std::string commandInDir; @@ -197,7 +197,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, # ifndef __VMS commandInDir += " 2>&1"; # endif - command = commandInDir.c_str(); + command = commandInDir; if (verbose) { cmSystemTools::Stdout("running "); cmSystemTools::Stdout(command); @@ -205,7 +205,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output, } fflush(stdout); fflush(stderr); - const char* cmd[] = { "/bin/sh", "-c", command, nullptr }; + const char* cmd[] = { "/bin/sh", "-c", command.c_str(), nullptr }; cmsysProcess_SetCommand(cp, cmd); #endif diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index dc5da74..ae0fa9b 100644 --- a/Source/cmExecProgramCommand.h +++ b/Source/cmExecProgramCommand.h @@ -37,7 +37,7 @@ public: cmExecutionStatus& status) override; private: - static bool RunCommand(const char* command, std::string& output, int& retVal, + static bool RunCommand(std::string command, std::string& output, int& retVal, const char* directory = nullptr, bool verbose = true, Encoding encoding = cmProcessOutput::Auto); }; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f5ec9fe..17a6a74 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -558,8 +558,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) std::string binaryFileName = this->Makefile->GetCurrentBinaryDirectory(); binaryFileName += "/CMakeFiles"; binaryFileName += "/FileCommandStringsBinaryFile"; - if (cmHexFileConverter::TryConvert(fileName.c_str(), - binaryFileName.c_str())) { + if (cmHexFileConverter::TryConvert(fileName, binaryFileName)) { fileName = binaryFileName; } } @@ -1405,6 +1404,12 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, cmMakeRange(args).advance(1)) // Get rid of subcommand { std::string fileName = arg; + if (fileName.empty()) { + std::string const r = recurse ? "REMOVE_RECURSE" : "REMOVE"; + this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, + "Ignoring empty file name in " + r + "."); + continue; + } if (!cmsys::SystemTools::FileIsFullPath(fileName)) { fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + arg; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4fa89d0..55374a4 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -784,11 +784,11 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) if (this->GetSystemName() == "WindowsPhone") { cmXMLElement(epg, "ApplicationType").Content("Windows Phone"); cmXMLElement(epg, "ApplicationTypeRevision") - .Content(this->GetSystemVersion()); + .Content(this->GetApplicationTypeRevision()); } else if (this->GetSystemName() == "WindowsStore") { cmXMLElement(epg, "ApplicationType").Content("Windows Store"); cmXMLElement(epg, "ApplicationTypeRevision") - .Content(this->GetSystemVersion()); + .Content(this->GetApplicationTypeRevision()); } if (!this->WindowsTargetPlatformVersion.empty()) { cmXMLElement(epg, "WindowsTargetPlatformVersion") @@ -1112,6 +1112,15 @@ std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion() return version; } +std::string cmGlobalVisualStudio10Generator::GetApplicationTypeRevision() const +{ + // Return the first two '.'-separated components of the Windows version. + std::string::size_type end1 = this->SystemVersion.find('.'); + std::string::size_type end2 = + end1 == std::string::npos ? end1 : this->SystemVersion.find('.', end1 + 1); + return this->SystemVersion.substr(0, end2); +} + static std::string cmLoadFlagTableString(Json::Value entry, const char* field) { if (entry.isMember(field)) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 2f532a6..1d30cd6 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -110,6 +110,9 @@ public: static std::string GetInstalledNsightTegraVersion(); + /** Return the first two components of CMAKE_SYSTEM_VERSION. */ + std::string GetApplicationTypeRevision() const; + cmIDEFlagTable const* GetClFlagTable() const; cmIDEFlagTable const* GetCSharpFlagTable() const; cmIDEFlagTable const* GetRcFlagTable() const; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 4b60279..a75d8a9 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -170,8 +170,9 @@ cmGraphVizWriter::cmGraphVizWriter(const cmGlobalGenerator* globalGenerator) { } -void cmGraphVizWriter::ReadSettings(const char* settingsFileName, - const char* fallbackSettingsFileName) +void cmGraphVizWriter::ReadSettings( + const std::string& settingsFileName, + const std::string& fallbackSettingsFileName) { cmake cm(cmake::RoleScript, cmState::Unknown); cm.SetHomeDirectory(""); @@ -181,8 +182,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, cmMakefile mf(&ggi, cm.GetCurrentSnapshot()); std::unique_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(&mf)); - const char* inFileName = settingsFileName; - + std::string inFileName = settingsFileName; if (!cmSystemTools::FileExists(inFileName)) { inFileName = fallbackSettingsFileName; if (!cmSystemTools::FileExists(inFileName)) { @@ -191,7 +191,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, } if (!mf.ReadListFile(inFileName)) { - cmSystemTools::Error("Problem opening GraphViz options file: ", + cmSystemTools::Error("Problem opening GraphViz options file: " + inFileName); return; } @@ -249,7 +249,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, // Iterate over all targets and write for each one a graph which shows // which other targets depend on it. -void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) +void cmGraphVizWriter::WriteTargetDependersFiles(const std::string& fileName) { if (!this->GenerateDependers) { return; @@ -291,7 +291,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) // Iterate over all targets and write for each one a graph which shows // on which targets it depends. -void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) +void cmGraphVizWriter::WritePerTargetFiles(const std::string& fileName) { if (!this->GeneratePerTarget) { return; @@ -327,7 +327,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) } } -void cmGraphVizWriter::WriteGlobalFile(const char* fileName) +void cmGraphVizWriter::WriteGlobalFile(const std::string& fileName) { this->CollectTargetsAndLibs(); @@ -392,7 +392,7 @@ void cmGraphVizWriter::WriteConnections( GlobalGenerator); for (auto const& llit : ll) { - const char* libName = llit.first.c_str(); + const std::string& libName = llit.first; std::map<std::string, std::string>::const_iterator libNameIt = this->TargetNamesNodes.find(libName); @@ -519,7 +519,7 @@ int cmGraphVizWriter::CollectAllTargets() for (cmLocalGenerator* lg : this->LocalGenerators) { const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); for (cmGeneratorTarget* target : targets) { - const char* realTargetName = target->GetName().c_str(); + const std::string& realTargetName = target->GetName(); if (this->IgnoreThisTarget(realTargetName)) { // Skip ignored targets continue; @@ -541,7 +541,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) for (cmLocalGenerator* lg : this->LocalGenerators) { const std::vector<cmGeneratorTarget*>& targets = lg->GetGeneratorTargets(); for (cmGeneratorTarget* target : targets) { - const char* realTargetName = target->GetName().c_str(); + const std::string& realTargetName = target->GetName(); if (this->IgnoreThisTarget(realTargetName)) { // Skip ignored targets continue; @@ -549,7 +549,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) const cmTarget::LinkLibraryVectorType* ll = &(target->Target->GetOriginalLinkLibraries()); for (auto const& llit : *ll) { - const char* libName = llit.first.c_str(); + std::string libName = llit.first; if (this->IgnoreThisTarget(libName)) { // Skip ignored targets continue; @@ -558,7 +558,7 @@ int cmGraphVizWriter::CollectAllExternalLibs(int cnt) if (GlobalGenerator->IsAlias(libName)) { const auto tgt = GlobalGenerator->FindTarget(libName); if (tgt) { - libName = tgt->GetName().c_str(); + libName = tgt->GetName(); } } diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index ed242f0..768683a 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -25,13 +25,13 @@ class cmGraphVizWriter public: cmGraphVizWriter(const cmGlobalGenerator* globalGenerator); - void ReadSettings(const char* settingsFileName, - const char* fallbackSettingsFileName); + void ReadSettings(const std::string& settingsFileName, + const std::string& fallbackSettingsFileName); - void WritePerTargetFiles(const char* fileName); - void WriteTargetDependersFiles(const char* fileName); + void WritePerTargetFiles(const std::string& fileName); + void WriteTargetDependersFiles(const std::string& fileName); - void WriteGlobalFile(const char* fileName); + void WriteGlobalFile(const std::string& fileName); protected: void CollectTargetsAndLibs(); diff --git a/Source/cmHexFileConverter.cxx b/Source/cmHexFileConverter.cxx index 4e29f39..190f2e3 100644 --- a/Source/cmHexFileConverter.cxx +++ b/Source/cmHexFileConverter.cxx @@ -128,7 +128,7 @@ static bool ConvertIntelHexLine(const char* buf, FILE* outFile) } cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( - const char* inFileName) + const std::string& inFileName) { char buf[1024]; FILE* inFile = cmsys::SystemTools::Fopen(inFileName, "rb"); @@ -170,8 +170,8 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType( return type; } -bool cmHexFileConverter::TryConvert(const char* inFileName, - const char* outFileName) +bool cmHexFileConverter::TryConvert(const std::string& inFileName, + const std::string& outFileName) { FileType type = DetermineFileType(inFileName); if (type == Binary) { diff --git a/Source/cmHexFileConverter.h b/Source/cmHexFileConverter.h index 25278e4..cb5de8f 100644 --- a/Source/cmHexFileConverter.h +++ b/Source/cmHexFileConverter.h @@ -4,6 +4,7 @@ #define cmHexFileConverter_h #include "cmConfigure.h" // IWYU pragma: keep +#include <string> /** \class cmHexFileConverter * \brief Can detects Intel Hex and Motorola S-record files and convert them @@ -19,8 +20,9 @@ public: IntelHex, MotorolaSrec }; - static FileType DetermineFileType(const char* inFileName); - static bool TryConvert(const char* inFileName, const char* outFileName); + static FileType DetermineFileType(const std::string& inFileName); + static bool TryConvert(const std::string& inFileName, + const std::string& outFileName); }; #endif diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 06063b2..b4a6a5d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -814,10 +814,15 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() return targetNames.Base; }(); - vars["SWIFT_MODULE"] = [this]() -> std::string { - cmGeneratorTarget::Names targetNames = - this->GetGeneratorTarget()->GetLibraryNames(this->GetConfigName()); + vars["SWIFT_MODULE_NAME"] = [this]() -> std::string { + if (const char* name = + this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) { + return name; + } + return this->GetGeneratorTarget()->GetName(); + }(); + vars["SWIFT_MODULE"] = [this](const std::string& module) -> std::string { std::string directory = this->GetLocalGenerator()->GetCurrentBinaryDirectory(); if (const char* prop = this->GetGeneratorTarget()->GetProperty( @@ -825,7 +830,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() directory = prop; } - std::string name = targetNames.Base + ".swiftmodule"; + std::string name = module + ".swiftmodule"; if (const char* prop = this->GetGeneratorTarget()->GetProperty("Swift_MODULE")) { name = prop; @@ -834,15 +839,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() return this->GetLocalGenerator()->ConvertToOutputFormat( this->ConvertToNinjaPath(directory + "/" + name), cmOutputConverter::SHELL); - }(); - - vars["SWIFT_MODULE_NAME"] = [this]() -> std::string { - if (const char* name = - this->GetGeneratorTarget()->GetProperty("Swift_MODULE_NAME")) { - return name; - } - return this->GetGeneratorTarget()->GetName(); - }(); + }(vars["SWIFT_MODULE_NAME"]); vars["SWIFT_OUTPUT_FILE_MAP"] = this->GetLocalGenerator()->ConvertToOutputFormat( @@ -1132,7 +1129,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetTargetFilePath(this->TargetNames.SharedObject)); // If one link has to be created. if (targetOutputReal == soName || targetOutput == soName) { - symlinkVars["SONAME"] = soName; + symlinkVars["SONAME"] = + this->GetLocalGenerator()->ConvertToOutputFormat( + soName, cmOutputConverter::SHELL); } else { symlinkVars["SONAME"].clear(); symlinks.push_back(soName); diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 88e415a..4358194 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -30,7 +30,7 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, this->SetError(e); return false; } - const char* destDir = args[1].c_str(); + const std::string& destDir = args[1]; std::vector<std::string> files; cmSystemTools::Glob(inputDir, "\\.h$", files); if (files.empty()) { @@ -42,14 +42,14 @@ bool cmUseMangledMesaCommand::InitialPass(std::vector<std::string> const& args, std::string path = inputDir; path += "/"; path += f; - this->CopyAndFullPathMesaHeader(path.c_str(), destDir); + this->CopyAndFullPathMesaHeader(path, destDir); } return true; } -void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, - const char* outdir) +void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader( + const std::string& source, const std::string& outdir) { std::string dir, file; cmSystemTools::SplitProgramPath(source, dir, file); @@ -65,9 +65,9 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, cmSystemTools::ReportLastSystemError(""); return; } - cmsys::ifstream fin(source); + cmsys::ifstream fin(source.c_str()); if (!fin) { - cmSystemTools::Error("Could not open file for read in copy operation", + cmSystemTools::Error("Could not open file for read in copy operation" + source); return; } diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 78f8616..e2f1d9b 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -20,7 +20,8 @@ public: cmExecutionStatus& status) override; protected: - void CopyAndFullPathMesaHeader(const char* source, const char* outdir); + void CopyAndFullPathMesaHeader(const std::string& source, + const std::string& outdir); }; #endif diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ab9ef79..af90383 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -4099,29 +4099,29 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) bool isAppContainer = false; bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone(); bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore(); - std::string const& v = this->GlobalGenerator->GetSystemVersion(); + std::string const& rev = this->GlobalGenerator->GetApplicationTypeRevision(); if (isWindowsPhone || isWindowsStore) { e1.Element("ApplicationType", (isWindowsPhone ? "Windows Phone" : "Windows Store")); e1.Element("DefaultLanguage", "en-US"); - if (cmHasLiteralPrefix(v, "10.0")) { - e1.Element("ApplicationTypeRevision", "10.0"); + if (rev == "10.0") { + e1.Element("ApplicationTypeRevision", rev); // Visual Studio 14.0 is necessary for building 10.0 apps e1.Element("MinimumVisualStudioVersion", "14.0"); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } - } else if (v == "8.1") { - e1.Element("ApplicationTypeRevision", v); + } else if (rev == "8.1") { + e1.Element("ApplicationTypeRevision", rev); // Visual Studio 12.0 is necessary for building 8.1 apps e1.Element("MinimumVisualStudioVersion", "12.0"); if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } - } else if (v == "8.0") { - e1.Element("ApplicationTypeRevision", v); + } else if (rev == "8.0") { + e1.Element("ApplicationTypeRevision", rev); // Visual Studio 11.0 is necessary for building 8.0 apps e1.Element("MinimumVisualStudioVersion", "11.0"); @@ -4153,7 +4153,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings(Elem& e1) "VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION"); if (targetPlatformMinVersion) { e1.Element("WindowsTargetPlatformMinVersion", targetPlatformMinVersion); - } else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) { + } else if (isWindowsStore && rev == "10.0") { // If the min version is not set, then use the TargetPlatformVersion if (!targetPlatformVersion.empty()) { e1.Element("WindowsTargetPlatformMinVersion", targetPlatformVersion); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d19de21..031123a 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -812,7 +812,7 @@ void cmake::SetArgs(const std::vector<std::string>& args) } // no option assume it is the path to the source or an existing build else { - this->SetDirectoriesFromFile(arg.c_str()); + this->SetDirectoriesFromFile(arg); } } @@ -855,7 +855,7 @@ cmake::LogLevel cmake::StringToLogLevel(const std::string& levelStr) return (it != levels.cend()) ? it->second : LogLevel::LOG_UNDEFINED; } -void cmake::SetDirectoriesFromFile(const char* arg) +void cmake::SetDirectoriesFromFile(const std::string& arg) { // Check if the argument refers to a CMakeCache.txt or // CMakeLists.txt file. @@ -1755,7 +1755,7 @@ int cmake::Generate() this->GlobalGenerator->Generate(); if (!this->GraphVizFile.empty()) { std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; - this->GenerateGraphViz(this->GraphVizFile.c_str()); + this->GenerateGraphViz(this->GraphVizFile); } if (this->WarnUnusedCli) { this->RunCheckForUnusedVariables(); @@ -2263,7 +2263,7 @@ void cmake::MarkCliAsUsed(const std::string& variable) this->UsedCliVariables[variable] = true; } -void cmake::GenerateGraphViz(const char* fileName) const +void cmake::GenerateGraphViz(const std::string& fileName) const { #ifdef CMAKE_BUILD_WITH_CMAKE cmGraphVizWriter gvWriter(this->GetGlobalGenerator()); @@ -2273,8 +2273,7 @@ void cmake::GenerateGraphViz(const char* fileName) const std::string fallbackSettingsFile = this->GetHomeDirectory(); fallbackSettingsFile += "/CMakeGraphVizOptions.cmake"; - gvWriter.ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str()); - + gvWriter.ReadSettings(settingsFile, fallbackSettingsFile); gvWriter.WritePerTargetFiles(fileName); gvWriter.WriteTargetDependersFiles(fileName); gvWriter.WriteGlobalFile(fileName); @@ -2652,7 +2651,7 @@ int cmake::Build(int jobs, const std::string& dir, // directories, which is required for running the generation step. std::string homeOrig = this->GetHomeDirectory(); std::string homeOutputOrig = this->GetHomeOutputDirectory(); - this->SetDirectoriesFromFile(cachePath.c_str()); + this->SetDirectoriesFromFile(cachePath); this->AddProjectCommands(); diff --git a/Source/cmake.h b/Source/cmake.h index 4a345cf..34d9bcd 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -495,13 +495,13 @@ protected: */ int CheckBuildSystem(); - void SetDirectoriesFromFile(const char* arg); + void SetDirectoriesFromFile(const std::string& arg); //! Make sure all commands are what they say they are and there is no /// macros. void CleanupCommandsAndMacros(); - void GenerateGraphViz(const char* fileName) const; + void GenerateGraphViz(const std::string& fileName) const; private: ProgressCallbackType ProgressCallback; |