mirror of
https://github.com/reactos/CMake.git
synced 2025-02-25 22:45:40 +00:00
cmInstallGenerator: std::string params
Several construction parameters converted to std::string Also made a few class members const
This commit is contained in:
parent
7a89e3c36c
commit
5e54b0cf2f
@ -196,14 +196,14 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
helper.Makefile->AddInstallGenerator(
|
||||
cm::make_unique<cmInstallScriptGenerator>(
|
||||
script, false, component.c_str(), exclude_from_all));
|
||||
cm::make_unique<cmInstallScriptGenerator>(script, false, component,
|
||||
exclude_from_all));
|
||||
} else if (doing_code) {
|
||||
doing_code = false;
|
||||
std::string const& code = arg;
|
||||
helper.Makefile->AddInstallGenerator(
|
||||
cm::make_unique<cmInstallScriptGenerator>(
|
||||
code, true, component.c_str(), exclude_from_all));
|
||||
cm::make_unique<cmInstallScriptGenerator>(code, true, component,
|
||||
exclude_from_all));
|
||||
}
|
||||
}
|
||||
|
||||
@ -942,7 +942,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
bool exclude_from_all = false;
|
||||
bool message_never = false;
|
||||
std::vector<std::string> dirs;
|
||||
const char* destination = nullptr;
|
||||
const std::string* destination = nullptr;
|
||||
std::string permissions_file;
|
||||
std::string permissions_dir;
|
||||
std::vector<std::string> configurations;
|
||||
@ -1101,7 +1101,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
} else if (doing == DoingConfigurations) {
|
||||
configurations.push_back(args[i]);
|
||||
} else if (doing == DoingDestination) {
|
||||
destination = args[i].c_str();
|
||||
destination = &args[i];
|
||||
doing = DoingNone;
|
||||
} else if (doing == DoingType) {
|
||||
if (allowedTypes.count(args[i]) == 0) {
|
||||
@ -1187,7 +1187,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
destinationStr = helper.GetDestinationForType(nullptr, type);
|
||||
destination = destinationStr.c_str();
|
||||
destination = &destinationStr;
|
||||
} else if (!type.empty()) {
|
||||
status.SetError(cmStrCat(args[0],
|
||||
" given both TYPE and DESTINATION "
|
||||
@ -1201,7 +1201,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Create the directory install generator.
|
||||
helper.Makefile->AddInstallGenerator(
|
||||
cm::make_unique<cmInstallDirectoryGenerator>(
|
||||
dirs, destination, permissions_file, permissions_dir, configurations,
|
||||
dirs, *destination, permissions_file, permissions_dir, configurations,
|
||||
component, message, exclude_from_all, literal_args, optional));
|
||||
|
||||
// Tell the global generator about any installation component names
|
||||
|
@ -12,12 +12,12 @@
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
|
||||
std::vector<std::string> const& dirs, const char* dest,
|
||||
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)
|
||||
: cmInstallGenerator(dest, configurations, component.c_str(), message,
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all)
|
||||
, LocalGenerator(nullptr)
|
||||
, Directories(dirs)
|
||||
|
@ -21,7 +21,8 @@ class cmInstallDirectoryGenerator : public cmInstallGenerator
|
||||
{
|
||||
public:
|
||||
cmInstallDirectoryGenerator(std::vector<std::string> const& dirs,
|
||||
const char* dest, std::string file_permissions,
|
||||
std::string const& dest,
|
||||
std::string file_permissions,
|
||||
std::string dir_permissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component,
|
||||
|
@ -22,8 +22,8 @@ cmInstallExportGenerator::cmInstallExportGenerator(
|
||||
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)
|
||||
: cmInstallGenerator(destination.c_str(), configurations, component.c_str(),
|
||||
message, exclude_from_all)
|
||||
: cmInstallGenerator(destination, configurations, component, message,
|
||||
exclude_from_all)
|
||||
, ExportSet(exportSet)
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, FileName(std::move(filename))
|
||||
|
@ -16,8 +16,8 @@ cmInstallFilesGenerator::cmInstallFilesGenerator(
|
||||
std::vector<std::string> const& configurations, std::string const& component,
|
||||
MessageLevel message, bool exclude_from_all, std::string rename,
|
||||
bool optional)
|
||||
: cmInstallGenerator(dest.c_str(), configurations, component.c_str(),
|
||||
message, exclude_from_all)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all)
|
||||
, LocalGenerator(nullptr)
|
||||
, Files(files)
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
|
@ -3,16 +3,17 @@
|
||||
#include "cmInstallGenerator.h"
|
||||
|
||||
#include <ostream>
|
||||
#include <utility>
|
||||
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
cmInstallGenerator::cmInstallGenerator(
|
||||
const char* destination, std::vector<std::string> const& configurations,
|
||||
const char* component, MessageLevel message, bool exclude_from_all)
|
||||
std::string destination, std::vector<std::string> const& configurations,
|
||||
std::string component, MessageLevel message, bool exclude_from_all)
|
||||
: cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations)
|
||||
, Destination(destination ? destination : "")
|
||||
, Component(component ? component : "")
|
||||
, Destination(std::move(destination))
|
||||
, Component(std::move(component))
|
||||
, Message(message)
|
||||
, ExcludeFromAll(exclude_from_all)
|
||||
{
|
||||
@ -139,8 +140,8 @@ void cmInstallGenerator::AddInstallRule(
|
||||
os << ")\n";
|
||||
}
|
||||
|
||||
std::string cmInstallGenerator::CreateComponentTest(const char* component,
|
||||
bool exclude_from_all)
|
||||
std::string cmInstallGenerator::CreateComponentTest(
|
||||
const std::string& component, bool exclude_from_all)
|
||||
{
|
||||
std::string result = R"("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "x)";
|
||||
result += component;
|
||||
@ -158,7 +159,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
|
||||
|
||||
// Begin this block of installation.
|
||||
std::string component_test =
|
||||
this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll);
|
||||
this->CreateComponentTest(this->Component, this->ExcludeFromAll);
|
||||
os << indent << "if(" << component_test << ")\n";
|
||||
|
||||
// Generate the script possibly with per-configuration code.
|
||||
|
@ -30,9 +30,9 @@ public:
|
||||
MessageNever
|
||||
};
|
||||
|
||||
cmInstallGenerator(const char* destination,
|
||||
cmInstallGenerator(std::string destination,
|
||||
std::vector<std::string> const& configurations,
|
||||
const char* component, MessageLevel message,
|
||||
std::string component, MessageLevel message,
|
||||
bool exclude_from_all);
|
||||
~cmInstallGenerator() override;
|
||||
|
||||
@ -65,14 +65,14 @@ public:
|
||||
protected:
|
||||
void GenerateScript(std::ostream& os) override;
|
||||
|
||||
std::string CreateComponentTest(const char* component,
|
||||
std::string CreateComponentTest(const std::string& component,
|
||||
bool exclude_from_all);
|
||||
|
||||
// Information shared by most generator types.
|
||||
std::string Destination;
|
||||
std::string Component;
|
||||
MessageLevel Message;
|
||||
bool ExcludeFromAll;
|
||||
std::string const Destination;
|
||||
std::string const Component;
|
||||
MessageLevel const Message;
|
||||
bool const ExcludeFromAll;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -12,11 +12,10 @@
|
||||
#include "cmPolicies.h"
|
||||
#include "cmScriptGenerator.h"
|
||||
|
||||
cmInstallScriptGenerator::cmInstallScriptGenerator(std::string script,
|
||||
bool code,
|
||||
const char* component,
|
||||
bool exclude_from_all)
|
||||
: cmInstallGenerator(nullptr, std::vector<std::string>(), component,
|
||||
cmInstallScriptGenerator::cmInstallScriptGenerator(
|
||||
std::string script, bool code, std::string const& component,
|
||||
bool exclude_from_all)
|
||||
: cmInstallGenerator("", std::vector<std::string>(), component,
|
||||
MessageDefault, exclude_from_all)
|
||||
, Script(std::move(script))
|
||||
, Code(code)
|
||||
|
@ -20,7 +20,8 @@ class cmInstallScriptGenerator : public cmInstallGenerator
|
||||
{
|
||||
public:
|
||||
cmInstallScriptGenerator(std::string script, bool code,
|
||||
const char* component, bool exclude_from_all);
|
||||
std::string const& component,
|
||||
bool exclude_from_all);
|
||||
~cmInstallScriptGenerator() override;
|
||||
|
||||
bool Compute(cmLocalGenerator* lg) override;
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
cmInstallSubdirectoryGenerator::cmInstallSubdirectoryGenerator(
|
||||
cmMakefile* makefile, std::string binaryDirectory, bool excludeFromAll)
|
||||
: cmInstallGenerator(nullptr, std::vector<std::string>(), nullptr,
|
||||
MessageDefault, excludeFromAll)
|
||||
: cmInstallGenerator("", std::vector<std::string>(), "", MessageDefault,
|
||||
excludeFromAll)
|
||||
, Makefile(makefile)
|
||||
, BinaryDirectory(std::move(binaryDirectory))
|
||||
{
|
||||
|
@ -29,8 +29,8 @@ cmInstallTargetGenerator::cmInstallTargetGenerator(
|
||||
std::string file_permissions, std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
bool optional, cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(dest.c_str(), configurations, component.c_str(),
|
||||
message, exclude_from_all)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all)
|
||||
, TargetName(std::move(targetName))
|
||||
, Target(nullptr)
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
|
@ -3028,7 +3028,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
|
||||
|
||||
// Include the user-specified pre-install script for this target.
|
||||
if (const char* preinstall = l->GetProperty("PRE_INSTALL_SCRIPT")) {
|
||||
cmInstallScriptGenerator g(preinstall, false, nullptr, false);
|
||||
cmInstallScriptGenerator g(preinstall, false, "", false);
|
||||
g.Generate(os, config, configurationTypes);
|
||||
}
|
||||
|
||||
@ -3081,7 +3081,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
|
||||
|
||||
// Include the user-specified post-install script for this target.
|
||||
if (const char* postinstall = l->GetProperty("POST_INSTALL_SCRIPT")) {
|
||||
cmInstallScriptGenerator g(postinstall, false, nullptr, false);
|
||||
cmInstallScriptGenerator g(postinstall, false, "", false);
|
||||
g.Generate(os, config, configurationTypes);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ protected:
|
||||
|
||||
std::string CreateConfigTest(const std::string& config);
|
||||
std::string CreateConfigTest(std::vector<std::string> const& configs);
|
||||
std::string CreateComponentTest(const char* component);
|
||||
std::string CreateComponentTest(const std::string& component);
|
||||
|
||||
// Information shared by most generator types.
|
||||
std::string RuntimeConfigVariable;
|
||||
|
Loading…
x
Reference in New Issue
Block a user