1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

cmInstallGenerator: Add backtrace to all install generators

This commit is contained in:
Brad King
2021-01-11 09:58:55 -05:00
parent eea61268e6
commit e32818dd76
18 changed files with 57 additions and 42 deletions

View File

@@ -133,7 +133,8 @@ std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
return cm::make_unique<cmInstallFilesGenerator>(
absFiles, destination, programs, args.GetPermissions(),
args.GetConfigurations(), args.GetComponent(), message,
args.GetExcludeFromAll(), args.GetRename(), args.GetOptional());
args.GetExcludeFromAll(), args.GetRename(), args.GetOptional(),
mf->GetBacktrace());
}
std::unique_ptr<cmInstallFilesGenerator> CreateInstallFilesGenerator(
@@ -206,14 +207,16 @@ bool HandleScriptMode(std::vector<std::string> const& args,
return false;
}
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallScriptGenerator>(script, false, component,
exclude_from_all));
cm::make_unique<cmInstallScriptGenerator>(
script, false, component, exclude_from_all,
helper.Makefile->GetBacktrace()));
} else if (doing_code) {
doing_code = false;
std::string const& code = arg;
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallScriptGenerator>(code, true, component,
exclude_from_all));
cm::make_unique<cmInstallScriptGenerator>(
code, true, component, exclude_from_all,
helper.Makefile->GetBacktrace()));
}
}
@@ -1253,7 +1256,8 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
helper.Makefile->AddInstallGenerator(
cm::make_unique<cmInstallDirectoryGenerator>(
dirs, *destination, permissions_file, permissions_dir, configurations,
component, message, exclude_from_all, literal_args, optional));
component, message, exclude_from_all, literal_args, optional,
helper.Makefile->GetBacktrace()));
// Tell the global generator about any installation component names
// specified.
@@ -1345,7 +1349,8 @@ bool HandleExportAndroidMKMode(std::vector<std::string> const& args,
cm::make_unique<cmInstallExportGenerator>(
&exportSet, ica.GetDestination(), ica.GetPermissions(),
ica.GetConfigurations(), ica.GetComponent(), message,
ica.GetExcludeFromAll(), fname, name_space, exportOld, true));
ica.GetExcludeFromAll(), fname, name_space, exportOld, true,
helper.Makefile->GetBacktrace()));
return true;
#else
@@ -1458,7 +1463,8 @@ bool HandleExportMode(std::vector<std::string> const& args,
cm::make_unique<cmInstallExportGenerator>(
&exportSet, ica.GetDestination(), ica.GetPermissions(),
ica.GetConfigurations(), ica.GetComponent(), message,
ica.GetExcludeFromAll(), fname, name_space, exportOld, false));
ica.GetExcludeFromAll(), fname, name_space, exportOld, false,
helper.Makefile->GetBacktrace()));
return true;
}

View File

@@ -16,9 +16,9 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
std::string file_permissions, std::string dir_permissions,
std::vector<std::string> const& configurations, std::string const& component,
MessageLevel message, bool exclude_from_all, std::string literal_args,
bool optional)
bool optional, cmListFileBacktrace backtrace)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
exclude_from_all, std::move(backtrace))
, LocalGenerator(nullptr)
, Directories(dirs)
, FilePermissions(std::move(file_permissions))

View File

@@ -9,6 +9,7 @@
#include <vector>
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
class cmLocalGenerator;
@@ -19,14 +20,12 @@ class cmLocalGenerator;
class cmInstallDirectoryGenerator : public cmInstallGenerator
{
public:
cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
std::string const& dest,
std::string file_permissions,
std::string dir_permissions,
std::vector<std::string> const& configurations,
std::string const& component,
MessageLevel message, bool exclude_from_all,
std::string literal_args, bool optional = false);
cmInstallDirectoryGenerator(
std::vector<std::string> const& dirs, std::string const& dest,
std::string file_permissions, std::string dir_permissions,
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool exclude_from_all,
std::string literal_args, bool optional, cmListFileBacktrace backtrace);
~cmInstallDirectoryGenerator() override;
bool Compute(cmLocalGenerator* lg) override;

View File

@@ -23,9 +23,10 @@ cmInstallExportGenerator::cmInstallExportGenerator(
cmExportSet* exportSet, std::string const& destination,
std::string file_permissions, std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message, bool exclude_from_all,
std::string filename, std::string name_space, bool exportOld, bool android)
std::string filename, std::string name_space, bool exportOld, bool android,
cmListFileBacktrace backtrace)
: cmInstallGenerator(destination, configurations, component, message,
exclude_from_all)
exclude_from_all, std::move(backtrace))
, ExportSet(exportSet)
, FilePermissions(std::move(file_permissions))
, FileName(std::move(filename))

View File

@@ -11,6 +11,7 @@
#include <vector>
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
class cmExportInstallFileGenerator;
@@ -29,7 +30,7 @@ public:
std::string const& component, MessageLevel message,
bool exclude_from_all, std::string filename,
std::string name_space, bool exportOld,
bool android);
bool android, cmListFileBacktrace backtrace);
cmInstallExportGenerator(const cmInstallExportGenerator&) = delete;
~cmInstallExportGenerator() override;

View File

@@ -125,7 +125,7 @@ static void CreateInstallGenerator(cmMakefile& makefile,
cmInstallGenerator::SelectMessageLevel(&makefile);
makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>(
files, destination, false, no_permissions, no_configurations, no_component,
message, no_exclude_from_all, no_rename));
message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace()));
}
/**

View File

@@ -15,9 +15,9 @@ cmInstallFilesGenerator::cmInstallFilesGenerator(
bool programs, std::string file_permissions,
std::vector<std::string> const& configurations, std::string const& component,
MessageLevel message, bool exclude_from_all, std::string rename,
bool optional)
bool optional, cmListFileBacktrace backtrace)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
exclude_from_all, std::move(backtrace))
, LocalGenerator(nullptr)
, Files(files)
, FilePermissions(std::move(file_permissions))

View File

@@ -9,6 +9,7 @@
#include <vector>
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
class cmLocalGenerator;
@@ -25,7 +26,7 @@ public:
std::vector<std::string> const& configurations,
std::string const& component, MessageLevel message,
bool exclude_from_all, std::string rename,
bool optional = false);
bool optional, cmListFileBacktrace backtrace);
~cmInstallFilesGenerator() override;
bool Compute(cmLocalGenerator* lg) override;

View File

@@ -10,12 +10,14 @@
cmInstallGenerator::cmInstallGenerator(
std::string destination, std::vector<std::string> const& configurations,
std::string component, MessageLevel message, bool exclude_from_all)
std::string component, MessageLevel message, bool exclude_from_all,
cmListFileBacktrace backtrace)
: cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations)
, Destination(std::move(destination))
, Component(std::move(component))
, Message(message)
, ExcludeFromAll(exclude_from_all)
, Backtrace(std::move(backtrace))
{
}

View File

@@ -9,6 +9,7 @@
#include <vector>
#include "cmInstallType.h"
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
class cmLocalGenerator;
@@ -32,7 +33,7 @@ public:
cmInstallGenerator(std::string destination,
std::vector<std::string> const& configurations,
std::string component, MessageLevel message,
bool exclude_from_all);
bool exclude_from_all, cmListFileBacktrace backtrace);
~cmInstallGenerator() override;
cmInstallGenerator(cmInstallGenerator const&) = delete;
@@ -61,6 +62,8 @@ public:
virtual bool Compute(cmLocalGenerator*) { return true; }
cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
protected:
void GenerateScript(std::ostream& os) override;
@@ -72,4 +75,5 @@ protected:
std::string const Component;
MessageLevel const Message;
bool const ExcludeFromAll;
cmListFileBacktrace const Backtrace;
};

View File

@@ -99,7 +99,7 @@ static void FinalAction(cmMakefile& makefile, std::string const& dest,
cmInstallGenerator::SelectMessageLevel(&makefile);
makefile.AddInstallGenerator(cm::make_unique<cmInstallFilesGenerator>(
files, destination, true, no_permissions, no_configurations, no_component,
message, no_exclude_from_all, no_rename));
message, no_exclude_from_all, no_rename, false, makefile.GetBacktrace()));
}
/**

View File

@@ -14,9 +14,9 @@
cmInstallScriptGenerator::cmInstallScriptGenerator(
std::string script, bool code, std::string const& component,
bool exclude_from_all)
bool exclude_from_all, cmListFileBacktrace backtrace)
: cmInstallGenerator("", std::vector<std::string>(), component,
MessageDefault, exclude_from_all)
MessageDefault, exclude_from_all, std::move(backtrace))
, Script(std::move(script))
, Code(code)
, AllowGenex(false)

View File

@@ -8,6 +8,7 @@
#include <string>
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
#include "cmScriptGenerator.h"
class cmLocalGenerator;
@@ -18,9 +19,10 @@ class cmLocalGenerator;
class cmInstallScriptGenerator : public cmInstallGenerator
{
public:
cmInstallScriptGenerator(std::string script, bool code,
std::string const& component,
bool exclude_from_all);
cmInstallScriptGenerator(
std::string script, bool code, std::string const& component,
bool exclude_from_all,
cmListFileBacktrace backtrace = cmListFileBacktrace());
~cmInstallScriptGenerator() override;
bool Compute(cmLocalGenerator* lg) override;

View File

@@ -14,9 +14,10 @@
#include "cmSystemTools.h"
cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator(
cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll)
cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll,
cmListFileBacktrace backtrace)
: cmInstallGenerator("", std::vector<std::string>(), "", MessageDefault,
excludeFromAll)
excludeFromAll, std::move(backtrace))
, Makefile(makefile)
, BinaryDirectory(std::move(binaryDirectory))
{

View File

@@ -8,6 +8,7 @@
#include <string>
#include "cmInstallGenerator.h"
#include "cmListFileCache.h"
class cmLocalGenerator;
class cmMakefile;
@@ -20,7 +21,8 @@ class cmInstallSubdirectoryGenerator : public cmInstallGenerator
public:
cmInstallSubdirectoryGenerator(cmMakefile* makefile,
std::string binaryDirectory,
bool excludeFromAll);
bool excludeFromAll,
cmListFileBacktrace backtrace);
~cmInstallSubdirectoryGenerator() override;
bool HaveInstall() override;

View File

@@ -46,13 +46,12 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
std::string const& component, MessageLevel message, bool exclude_from_all,
bool optional, cmListFileBacktrace backtrace)
: cmInstallGenerator(dest, configurations, component, message,
exclude_from_all)
exclude_from_all, std::move(backtrace))
, TargetName(std::move(targetName))
, Target(nullptr)
, FilePermissions(std::move(file_permissions))
, ImportLibrary(implib)
, Optional(optional)
, Backtrace(std::move(backtrace))
{
this->ActionsPerConfig = true;
this->NamelinkMode = NamelinkModeNone;

View File

@@ -66,8 +66,6 @@ public:
std::string GetDestination(std::string const& config) const;
cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
struct Files
{
// Names or paths of files to be read from the source or build tree.
@@ -134,5 +132,4 @@ protected:
NamelinkModeType NamelinkMode;
bool const ImportLibrary;
bool const Optional;
cmListFileBacktrace const Backtrace;
};

View File

@@ -1838,7 +1838,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
}
this->AddInstallGenerator(cm::make_unique<cmInstallSubdirectoryGenerator>(
subMf, binPath, excludeFromAll));
subMf, binPath, excludeFromAll, this->GetBacktrace()));
}
const std::string& cmMakefile::GetCurrentSourceDirectory() const