summaryrefslogtreecommitdiffstats
path: root/Source/cmOutputRequiredFilesCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-08-28 15:49:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-08-28 15:49:32 (GMT)
commitae861c196ad2128409f231fff3024b624918311d (patch)
treeaaeb6fc56a9ba68cdaa2f3ff9bd3ab6d1227b018 /Source/cmOutputRequiredFilesCommand.cxx
parent3c7d09e46512e8a69476cf4dfda6ace488a49244 (diff)
parent54872b73b9436086fd4a801b1224ebeb81af3935 (diff)
downloadCMake-ae861c196ad2128409f231fff3024b624918311d.zip
CMake-ae861c196ad2128409f231fff3024b624918311d.tar.gz
CMake-ae861c196ad2128409f231fff3024b624918311d.tar.bz2
Merge topic 'cmCommand_refactor_disallowed'
54872b73b9 cmCommand refactor: remove cmDisallowedCommand class 11f35d340e cmCommand refactor: remove unused AddDisallowedCommand overload ae51aa32f0 cmCommand refactor: cmVariableRequiresCommand 185fa2c4f3 cmCommand refactor: cmUtilitySourceCommand c8deeac68f cmCommand refactor: cmSubdirDependsCommand c2c222eba1 cmCommand refactor: cmOutputRequiredFilesCommand 7533e47ccc cmCommand refactor: cmLoadCommandCommand 9d6fc3f5ed cmCommand refactor: cmExportLibraryDependenciesCommand ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3736
Diffstat (limited to 'Source/cmOutputRequiredFilesCommand.cxx')
-rw-r--r--Source/cmOutputRequiredFilesCommand.cxx41
1 files changed, 24 insertions, 17 deletions
diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx
index dbb7111..3d8ebc3 100644
--- a/Source/cmOutputRequiredFilesCommand.cxx
+++ b/Source/cmOutputRequiredFilesCommand.cxx
@@ -5,9 +5,12 @@
#include "cmsys/FStream.hxx"
#include "cmsys/RegularExpression.hxx"
#include <map>
+#include <set>
+#include <stdio.h>
#include <utility>
#include "cmAlgorithms.h"
+#include "cmExecutionStatus.h"
#include "cmGeneratorExpression.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
@@ -15,8 +18,7 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
-class cmExecutionStatus;
-
+namespace {
/** \class cmDependInformation
* \brief Store dependency information for a single source file.
*
@@ -452,43 +454,47 @@ protected:
DirectoryToFileToPathMapType DirectoryToFileToPathMap;
};
+void ListDependencies(cmDependInformation const* info, FILE* fout,
+ std::set<cmDependInformation const*>* visited);
+}
+
// cmOutputRequiredFilesCommand
-bool cmOutputRequiredFilesCommand::InitialPass(
- std::vector<std::string> const& args, cmExecutionStatus&)
+bool cmOutputRequiredFilesCommand(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;
}
// store the arg for final pass
- this->File = args[0];
- this->OutputFile = args[1];
+ const std::string& file = args[0];
+ const std::string& outputFile = args[1];
// compute the list of files
cmLBDepend md;
- md.SetMakefile(this->Makefile);
- md.AddSearchPath(this->Makefile->GetCurrentSourceDirectory());
+ md.SetMakefile(&status.GetMakefile());
+ md.AddSearchPath(status.GetMakefile().GetCurrentSourceDirectory());
// find the depends for a file
- const cmDependInformation* info = md.FindDependencies(this->File.c_str());
+ const cmDependInformation* info = md.FindDependencies(file.c_str());
if (info) {
// write them out
- FILE* fout = cmsys::SystemTools::Fopen(this->OutputFile, "w");
+ FILE* fout = cmsys::SystemTools::Fopen(outputFile, "w");
if (!fout) {
- this->SetError(cmStrCat("Can not open output file: ", this->OutputFile));
+ status.SetError(cmStrCat("Can not open output file: ", outputFile));
return false;
}
std::set<cmDependInformation const*> visited;
- this->ListDependencies(info, fout, &visited);
+ ListDependencies(info, fout, &visited);
fclose(fout);
}
return true;
}
-void cmOutputRequiredFilesCommand::ListDependencies(
- cmDependInformation const* info, FILE* fout,
- std::set<cmDependInformation const*>* visited)
+namespace {
+void ListDependencies(cmDependInformation const* info, FILE* fout,
+ std::set<cmDependInformation const*>* visited)
{
// add info to the visited set
visited->insert(info);
@@ -503,7 +509,8 @@ void cmOutputRequiredFilesCommand::ListDependencies(
fprintf(fout, "%s\n", d->FullPath.c_str());
}
}
- this->ListDependencies(d, fout, visited);
+ ListDependencies(d, fout, visited);
}
}
}
+}