diff options
Diffstat (limited to 'Source/cmAuxSourceDirectoryCommand.cxx')
-rw-r--r-- | Source/cmAuxSourceDirectoryCommand.cxx | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 106e7a7..289bb72 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -2,41 +2,39 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmAuxSourceDirectoryCommand.h" -#include "cmsys/Directory.hxx" #include <algorithm> -#include <stddef.h> +#include <cstddef> #include <utility> -#include "cmAlgorithms.h" +#include "cmsys/Directory.hxx" + +#include "cmExecutionStatus.h" #include "cmMakefile.h" #include "cmSourceFile.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmake.h" -class cmExecutionStatus; - -// cmAuxSourceDirectoryCommand -bool cmAuxSourceDirectoryCommand::InitialPass( - std::vector<std::string> const& args, cmExecutionStatus&) +bool cmAuxSourceDirectoryCommand(std::vector<std::string> const& args, + cmExecutionStatus& status) { if (args.size() != 2) { - this->SetError("called with incorrect number of arguments"); + status.SetError("called with incorrect number of arguments"); return false; } + cmMakefile& mf = status.GetMakefile(); std::string sourceListValue; std::string const& templateDirectory = args[0]; std::string tdir; if (!cmSystemTools::FileIsFullPath(templateDirectory)) { - tdir = this->Makefile->GetCurrentSourceDirectory(); - tdir += "/"; - tdir += templateDirectory; + tdir = cmStrCat(mf.GetCurrentSourceDirectory(), '/', templateDirectory); } else { tdir = templateDirectory; } // was the list already populated - const char* def = this->Makefile->GetDefinition(args[1]); + const char* def = mf.GetDefinition(args[1]); if (def) { sourceListValue = def; } @@ -55,14 +53,12 @@ bool cmAuxSourceDirectoryCommand::InitialPass( std::string ext = file.substr(dotpos + 1); std::string base = file.substr(0, dotpos); // Process only source files - auto cm = this->Makefile->GetCMakeInstance(); + auto cm = mf.GetCMakeInstance(); if (!base.empty() && cm->IsSourceExtension(ext)) { - std::string fullname = templateDirectory; - fullname += "/"; - fullname += file; + std::string fullname = cmStrCat(templateDirectory, '/', file); // add the file as a class file so // depends can be done - cmSourceFile* sf = this->Makefile->GetOrCreateSource(fullname); + cmSourceFile* sf = mf.GetOrCreateSource(fullname); sf->SetProperty("ABSTRACT", "0"); files.push_back(std::move(fullname)); } @@ -74,6 +70,6 @@ bool cmAuxSourceDirectoryCommand::InitialPass( sourceListValue += ";"; } sourceListValue += cmJoin(files, ";"); - this->Makefile->AddDefinition(args[1], sourceListValue.c_str()); + mf.AddDefinition(args[1], sourceListValue); return true; } |