mirror of
https://github.com/Kitware/CMake.git
synced 2026-06-24 08:47:59 +00:00
Merge topic 'install-style'
732b9585a7 Style: Use camelCase identifiers
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12016
This commit is contained in:
14
.clang-tidy
14
.clang-tidy
@@ -90,4 +90,18 @@ CheckOptions:
|
||||
value: '0'
|
||||
- key: modernize-use-auto.MinTypeNameLength
|
||||
value: '80'
|
||||
- key: readability-identifier-naming.ClassCase
|
||||
value: 'CamelCase'
|
||||
- key: readability-identifier-naming.ClassIgnoredRegexp
|
||||
value: 'cm[A-Z][A-Za-z]+|(const_)?iterator'
|
||||
- key: readability-identifier-naming.ClassMemberCase
|
||||
value: 'CamelCase'
|
||||
- key: readability-identifier-naming.ClassMemberIgnoredRegexp
|
||||
value: 'prop[A-Z_]+'
|
||||
- key: readability-identifier-naming.PrivateMemberCase
|
||||
value: 'CamelCase'
|
||||
- key: readability-identifier-naming.ParameterCase
|
||||
value: 'camelBack'
|
||||
- key: readability-identifier-naming.LocalVariableCase
|
||||
value: 'camelBack'
|
||||
...
|
||||
|
||||
@@ -306,10 +306,10 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
|
||||
std::string component = helper.DefaultComponentName;
|
||||
int componentCount = 0;
|
||||
bool doing_script = false;
|
||||
bool doing_code = false;
|
||||
bool exclude_from_all = false;
|
||||
bool all_components = false;
|
||||
bool doingScript = false;
|
||||
bool doingCode = false;
|
||||
bool excludeFromAll = false;
|
||||
bool allComponents = false;
|
||||
|
||||
// Scan the args once for COMPONENT. Only allow one.
|
||||
//
|
||||
@@ -320,9 +320,9 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
component = args[i];
|
||||
}
|
||||
if (args[i] == "EXCLUDE_FROM_ALL") {
|
||||
exclude_from_all = true;
|
||||
excludeFromAll = true;
|
||||
} else if (args[i] == "ALL_COMPONENTS") {
|
||||
all_components = true;
|
||||
allComponents = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (all_components && componentCount == 1) {
|
||||
if (allComponents && componentCount == 1) {
|
||||
status.SetError("ALL_COMPONENTS and COMPONENT are mutually exclusive");
|
||||
return false;
|
||||
}
|
||||
@@ -343,16 +343,16 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
//
|
||||
for (std::string const& arg : args) {
|
||||
if (arg == "SCRIPT") {
|
||||
doing_script = true;
|
||||
doing_code = false;
|
||||
doingScript = true;
|
||||
doingCode = false;
|
||||
} else if (arg == "CODE") {
|
||||
doing_script = false;
|
||||
doing_code = true;
|
||||
doingScript = false;
|
||||
doingCode = true;
|
||||
} else if (arg == "COMPONENT") {
|
||||
doing_script = false;
|
||||
doing_code = false;
|
||||
} else if (doing_script) {
|
||||
doing_script = false;
|
||||
doingScript = false;
|
||||
doingCode = false;
|
||||
} else if (doingScript) {
|
||||
doingScript = false;
|
||||
std::string script = arg;
|
||||
if (!cmHasLiteralPrefix(script, "$<INSTALL_PREFIX>")) {
|
||||
if (!cmSystemTools::FileIsFullPath(script)) {
|
||||
@@ -366,23 +366,23 @@ bool HandleScriptMode(std::vector<std::string> const& args,
|
||||
}
|
||||
helper.Makefile->AddInstallGenerator(
|
||||
cm::make_unique<cmInstallScriptGenerator>(
|
||||
script, false, component, exclude_from_all, all_components,
|
||||
script, false, component, excludeFromAll, allComponents,
|
||||
helper.Makefile->GetBacktrace()));
|
||||
} else if (doing_code) {
|
||||
doing_code = false;
|
||||
} else if (doingCode) {
|
||||
doingCode = false;
|
||||
std::string const& code = arg;
|
||||
helper.Makefile->AddInstallGenerator(
|
||||
cm::make_unique<cmInstallScriptGenerator>(
|
||||
code, true, component, exclude_from_all, all_components,
|
||||
code, true, component, excludeFromAll, allComponents,
|
||||
helper.Makefile->GetBacktrace()));
|
||||
}
|
||||
}
|
||||
|
||||
if (doing_script) {
|
||||
if (doingScript) {
|
||||
status.SetError("given no value for SCRIPT argument.");
|
||||
return false;
|
||||
}
|
||||
if (doing_code) {
|
||||
if (doingCode) {
|
||||
status.SetError("given no value for CODE argument.");
|
||||
return false;
|
||||
}
|
||||
@@ -699,11 +699,11 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
|
||||
cmTarget* target = helper.Makefile->FindLocalNonAliasTarget(tgt);
|
||||
if (!target) {
|
||||
// If no local target has been found, find it in the global scope.
|
||||
cmTarget* const global_target =
|
||||
cmTarget* const globalTarget =
|
||||
helper.Makefile->GetGlobalGenerator()->FindTarget(
|
||||
tgt, { cmStateEnums::TargetDomain::NATIVE });
|
||||
if (global_target && !global_target->IsImported()) {
|
||||
target = global_target;
|
||||
if (globalTarget && !globalTarget->IsImported()) {
|
||||
target = globalTarget;
|
||||
}
|
||||
}
|
||||
if (target) {
|
||||
@@ -1364,11 +1364,11 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
|
||||
cmTarget* target = helper.Makefile->FindTargetToUse(tgt);
|
||||
if (!target || !target->IsImported()) {
|
||||
// If no local target has been found, find it in the global scope.
|
||||
cmTarget* const global_target =
|
||||
cmTarget* const globalTarget =
|
||||
helper.Makefile->GetGlobalGenerator()->FindTarget(
|
||||
tgt, { cmStateEnums::TargetDomain::NATIVE });
|
||||
if (global_target && global_target->IsImported()) {
|
||||
target = global_target;
|
||||
if (globalTarget && globalTarget->IsImported()) {
|
||||
target = globalTarget;
|
||||
}
|
||||
}
|
||||
if (target) {
|
||||
@@ -1634,21 +1634,21 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
DoingType
|
||||
};
|
||||
Doing doing = DoingDirs;
|
||||
bool in_match_mode = false;
|
||||
bool inMatchMode = false;
|
||||
bool optional = false;
|
||||
bool exclude_from_all = false;
|
||||
bool message_never = false;
|
||||
bool excludeFromAll = false;
|
||||
bool messageNever = false;
|
||||
std::vector<std::string> dirs;
|
||||
cm::optional<std::string> destination;
|
||||
std::string permissions_file;
|
||||
std::string permissions_dir;
|
||||
std::string permissionsFile;
|
||||
std::string permissionsDir;
|
||||
std::vector<std::string> configurations;
|
||||
std::string component = helper.DefaultComponentName;
|
||||
std::string literal_args;
|
||||
std::string literalArgs;
|
||||
std::string type;
|
||||
for (unsigned int i = 1; i < args.size(); ++i) {
|
||||
if (args[i] == "DESTINATION") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1657,7 +1657,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Switch to setting the destination property.
|
||||
doing = DoingDestination;
|
||||
} else if (args[i] == "TYPE") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1666,7 +1666,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Switch to setting the type.
|
||||
doing = DoingType;
|
||||
} else if (args[i] == "OPTIONAL") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1676,44 +1676,44 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
optional = true;
|
||||
doing = DoingNone;
|
||||
} else if (args[i] == "MESSAGE_NEVER") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mark the rule as quiet.
|
||||
message_never = true;
|
||||
messageNever = true;
|
||||
doing = DoingNone;
|
||||
} else if (args[i] == "PATTERN") {
|
||||
// Switch to a new pattern match rule.
|
||||
doing = DoingPattern;
|
||||
in_match_mode = true;
|
||||
inMatchMode = true;
|
||||
} else if (args[i] == "REGEX") {
|
||||
// Switch to a new regex match rule.
|
||||
doing = DoingRegex;
|
||||
in_match_mode = true;
|
||||
inMatchMode = true;
|
||||
} else if (args[i] == "EXCLUDE") {
|
||||
// Add this property to the current match rule.
|
||||
if (!in_match_mode || doing == DoingPattern || doing == DoingRegex) {
|
||||
if (!inMatchMode || doing == DoingPattern || doing == DoingRegex) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" before a PATTERN or REGEX is given."));
|
||||
return false;
|
||||
}
|
||||
literal_args += " EXCLUDE";
|
||||
literalArgs += " EXCLUDE";
|
||||
doing = DoingNone;
|
||||
} else if (args[i] == "PERMISSIONS") {
|
||||
if (!in_match_mode) {
|
||||
if (!inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" before a PATTERN or REGEX is given."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Switch to setting the current match permissions property.
|
||||
literal_args += " PERMISSIONS";
|
||||
literalArgs += " PERMISSIONS";
|
||||
doing = DoingPermsMatch;
|
||||
} else if (args[i] == "FILE_PERMISSIONS") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1722,7 +1722,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Switch to setting the file permissions property.
|
||||
doing = DoingPermsFile;
|
||||
} else if (args[i] == "DIRECTORY_PERMISSIONS") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1731,27 +1731,27 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Switch to setting the directory permissions property.
|
||||
doing = DoingPermsDir;
|
||||
} else if (args[i] == "USE_SOURCE_PERMISSIONS") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add this option literally.
|
||||
literal_args += " USE_SOURCE_PERMISSIONS";
|
||||
literalArgs += " USE_SOURCE_PERMISSIONS";
|
||||
doing = DoingNone;
|
||||
} else if (args[i] == "FILES_MATCHING") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Add this option literally.
|
||||
literal_args += " FILES_MATCHING";
|
||||
literalArgs += " FILES_MATCHING";
|
||||
doing = DoingNone;
|
||||
} else if (args[i] == "CONFIGURATIONS") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1760,7 +1760,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Switch to setting the configurations property.
|
||||
doing = DoingConfigurations;
|
||||
} else if (args[i] == "COMPONENT") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
@@ -1769,12 +1769,12 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// Switch to setting the component property.
|
||||
doing = DoingComponent;
|
||||
} else if (args[i] == "EXCLUDE_FROM_ALL") {
|
||||
if (in_match_mode) {
|
||||
if (inMatchMode) {
|
||||
status.SetError(cmStrCat(args[0], " does not allow \"", args[i],
|
||||
"\" after PATTERN or REGEX."));
|
||||
return false;
|
||||
}
|
||||
exclude_from_all = true;
|
||||
excludeFromAll = true;
|
||||
doing = DoingNone;
|
||||
} else if (doing == DoingDirs) {
|
||||
// If the given directory is not a full path, convert it to one by
|
||||
@@ -1833,14 +1833,14 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
// leading slash and trailing end-of-string in the matched
|
||||
// string to make sure the pattern matches only whole file
|
||||
// names.
|
||||
literal_args += " REGEX \"/";
|
||||
literalArgs += " REGEX \"/";
|
||||
std::string regex = cmsys::Glob::PatternToRegex(args[i], false);
|
||||
cmSystemTools::ReplaceString(regex, "\\", "\\\\");
|
||||
literal_args += regex;
|
||||
literal_args += "$\"";
|
||||
literalArgs += regex;
|
||||
literalArgs += "$\"";
|
||||
doing = DoingNone;
|
||||
} else if (doing == DoingRegex) {
|
||||
literal_args += " REGEX \"";
|
||||
literalArgs += " REGEX \"";
|
||||
// Match rules are case-insensitive on some platforms.
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
std::string regex = cmSystemTools::LowerCase(args[i]);
|
||||
@@ -1848,8 +1848,8 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
std::string regex = args[i];
|
||||
#endif
|
||||
cmSystemTools::ReplaceString(regex, "\\", "\\\\");
|
||||
literal_args += regex;
|
||||
literal_args += "\"";
|
||||
literalArgs += regex;
|
||||
literalArgs += "\"";
|
||||
doing = DoingNone;
|
||||
} else if (doing == DoingComponent) {
|
||||
component = args[i];
|
||||
@@ -1857,7 +1857,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
} else if (doing == DoingPermsFile) {
|
||||
// Check the requested permission.
|
||||
if (!cmInstallCommandArguments::CheckPermissions(args[i],
|
||||
permissions_file)) {
|
||||
permissionsFile)) {
|
||||
status.SetError(cmStrCat(args[0], " given invalid file permission \"",
|
||||
args[i], "\"."));
|
||||
return false;
|
||||
@@ -1865,15 +1865,14 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
} else if (doing == DoingPermsDir) {
|
||||
// Check the requested permission.
|
||||
if (!cmInstallCommandArguments::CheckPermissions(args[i],
|
||||
permissions_dir)) {
|
||||
permissionsDir)) {
|
||||
status.SetError(cmStrCat(
|
||||
args[0], " given invalid directory permission \"", args[i], "\"."));
|
||||
return false;
|
||||
}
|
||||
} else if (doing == DoingPermsMatch) {
|
||||
// Check the requested permission.
|
||||
if (!cmInstallCommandArguments::CheckPermissions(args[i],
|
||||
literal_args)) {
|
||||
if (!cmInstallCommandArguments::CheckPermissions(args[i], literalArgs)) {
|
||||
status.SetError(
|
||||
cmStrCat(args[0], " given invalid permission \"", args[i], "\"."));
|
||||
return false;
|
||||
@@ -1910,7 +1909,7 @@ bool HandleDirectoryMode(std::vector<std::string> const& args,
|
||||
}
|
||||
|
||||
cmInstallGenerator::MessageLevel message =
|
||||
cmInstallGenerator::SelectMessageLevel(helper.Makefile, message_never);
|
||||
cmInstallGenerator::SelectMessageLevel(helper.Makefile, messageNever);
|
||||
|
||||
// Check for an absolute destination.
|
||||
if (cmGeneratorExpression::Find(*destination) == std::string::npos &&
|
||||
@@ -1924,8 +1923,8 @@ 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,
|
||||
component, message, exclude_from_all, literal_args, optional,
|
||||
dirs, *destination, permissionsFile, permissionsDir, configurations,
|
||||
component, message, excludeFromAll, literalArgs, optional,
|
||||
helper.Makefile->GetBacktrace()));
|
||||
|
||||
// Tell the global generator about any installation component names
|
||||
@@ -1945,12 +1944,12 @@ bool HandleExportAndroidMKMode(std::vector<std::string> const& args,
|
||||
cmInstallCommandArguments ica(helper.DefaultComponentName, *helper.Makefile);
|
||||
|
||||
std::string exp;
|
||||
std::string name_space;
|
||||
std::string exportNamespace;
|
||||
bool exportOld = false;
|
||||
std::string filename;
|
||||
|
||||
ica.Bind("EXPORT_ANDROID_MK"_s, exp);
|
||||
ica.Bind("NAMESPACE"_s, name_space);
|
||||
ica.Bind("NAMESPACE"_s, exportNamespace);
|
||||
ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld);
|
||||
ica.Bind("FILE"_s, filename);
|
||||
|
||||
@@ -2022,7 +2021,7 @@ bool HandleExportAndroidMKMode(std::vector<std::string> const& args,
|
||||
cm::make_unique<cmInstallAndroidMKExportGenerator>(
|
||||
&exportSet, ica.GetDestination(), ica.GetPermissions(),
|
||||
ica.GetConfigurations(), ica.GetComponent(), message,
|
||||
ica.GetExcludeFromAll(), std::move(fname), std::move(name_space),
|
||||
ica.GetExcludeFromAll(), std::move(fname), std::move(exportNamespace),
|
||||
helper.Makefile->GetBacktrace()));
|
||||
|
||||
return true;
|
||||
@@ -2188,17 +2187,17 @@ bool HandleExportMode(std::vector<std::string> const& args,
|
||||
cmInstallCommandArguments ica(helper.DefaultComponentName, *helper.Makefile);
|
||||
|
||||
std::string exp;
|
||||
std::string name_space;
|
||||
std::string exportNamespace;
|
||||
bool exportOld = false;
|
||||
std::string filename;
|
||||
std::string cxx_modules_directory;
|
||||
std::string cxxModulesDirectory;
|
||||
bool exportPackageDependencies = false;
|
||||
|
||||
ica.Bind("EXPORT"_s, exp);
|
||||
ica.Bind("NAMESPACE"_s, name_space);
|
||||
ica.Bind("NAMESPACE"_s, exportNamespace);
|
||||
ica.Bind("EXPORT_LINK_INTERFACE_LIBRARIES"_s, exportOld);
|
||||
ica.Bind("FILE"_s, filename);
|
||||
ica.Bind("CXX_MODULES_DIRECTORY"_s, cxx_modules_directory);
|
||||
ica.Bind("CXX_MODULES_DIRECTORY"_s, cxxModulesDirectory);
|
||||
|
||||
if (cmExperimental::HasSupportEnabled(
|
||||
status.GetMakefile(),
|
||||
@@ -2288,8 +2287,7 @@ bool HandleExportMode(std::vector<std::string> const& args,
|
||||
cm::optional<cm::string_view> const directive = MatchExport(pie, exp);
|
||||
if (directive) {
|
||||
if (!HandleMappedPackageInfo(exportSet, *directive, helper, ica,
|
||||
status, message,
|
||||
cxx_modules_directory)) {
|
||||
status, message, cxxModulesDirectory)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2303,8 +2301,8 @@ bool HandleExportMode(std::vector<std::string> const& args,
|
||||
cm::make_unique<cmInstallCMakeConfigExportGenerator>(
|
||||
&exportSet, ica.GetDestination(), ica.GetPermissions(),
|
||||
ica.GetConfigurations(), ica.GetComponent(), message,
|
||||
ica.GetExcludeFromAll(), std::move(fname), std::move(name_space),
|
||||
std::move(cxx_modules_directory), exportOld, exportPackageDependencies,
|
||||
ica.GetExcludeFromAll(), std::move(fname), std::move(exportNamespace),
|
||||
std::move(cxxModulesDirectory), exportOld, exportPackageDependencies,
|
||||
helper.Makefile->GetBacktrace()));
|
||||
|
||||
return true;
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
#include "cmStringAlgorithms.h"
|
||||
|
||||
cmInstallCxxModuleBmiGenerator::cmInstallCxxModuleBmiGenerator(
|
||||
std::string target, std::string const& dest, std::string file_permissions,
|
||||
std::string target, std::string const& dest, std::string filePermissions,
|
||||
std::vector<std::string> const& configurations, std::string const& component,
|
||||
MessageLevel message, bool exclude_from_all, bool optional,
|
||||
MessageLevel message, bool excludeFromAll, bool optional,
|
||||
cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all, false, std::move(backtrace))
|
||||
excludeFromAll, false, std::move(backtrace))
|
||||
, TargetName(std::move(target))
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, FilePermissions(std::move(filePermissions))
|
||||
, Optional(optional)
|
||||
{
|
||||
this->ActionsPerConfig = true;
|
||||
@@ -46,12 +46,12 @@ bool cmInstallCxxModuleBmiGenerator::Compute(cmLocalGenerator* lg)
|
||||
std::string cmInstallCxxModuleBmiGenerator::GetScriptLocation(
|
||||
std::string const& config) const
|
||||
{
|
||||
char const* config_name = config.c_str();
|
||||
char const* configName = config.c_str();
|
||||
if (config.empty()) {
|
||||
config_name = "noconfig";
|
||||
configName = "noconfig";
|
||||
}
|
||||
return cmStrCat(this->Target->GetCMFSupportDirectory(),
|
||||
"/install-cxx-module-bmi-", config_name, ".cmake");
|
||||
"/install-cxx-module-bmi-", configName, ".cmake");
|
||||
}
|
||||
|
||||
std::string cmInstallCxxModuleBmiGenerator::GetDestination(
|
||||
|
||||
@@ -21,9 +21,9 @@ class cmInstallCxxModuleBmiGenerator : public cmInstallGenerator
|
||||
{
|
||||
public:
|
||||
cmInstallCxxModuleBmiGenerator(
|
||||
std::string target, std::string const& dest, std::string file_permissions,
|
||||
std::string target, std::string const& dest, std::string filePermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
bool optional, cmListFileBacktrace backtrace);
|
||||
~cmInstallCxxModuleBmiGenerator() override;
|
||||
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
cmInstallDirectoryGenerator::cmInstallDirectoryGenerator(
|
||||
std::vector<std::string> const& dirs, std::string const& dest,
|
||||
std::string file_permissions, std::string dir_permissions,
|
||||
std::string filePermissions, std::string dirPermissions,
|
||||
std::vector<std::string> const& configurations, std::string const& component,
|
||||
MessageLevel message, bool exclude_from_all, std::string literal_args,
|
||||
MessageLevel message, bool excludeFromAll, std::string literalArgs,
|
||||
bool optional, cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all, false, std::move(backtrace))
|
||||
excludeFromAll, false, std::move(backtrace))
|
||||
, Directories(dirs)
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, DirPermissions(std::move(dir_permissions))
|
||||
, LiteralArguments(std::move(literal_args))
|
||||
, FilePermissions(std::move(filePermissions))
|
||||
, DirPermissions(std::move(dirPermissions))
|
||||
, LiteralArguments(std::move(literalArgs))
|
||||
, Optional(optional)
|
||||
{
|
||||
// We need per-config actions if destination have generator expressions.
|
||||
@@ -107,11 +107,11 @@ void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
|
||||
std::vector<std::string> const& dirs)
|
||||
{
|
||||
// Write code to install the directories.
|
||||
char const* no_rename = nullptr;
|
||||
char const* noRename = nullptr;
|
||||
this->AddInstallRule(os, this->GetDestination(config),
|
||||
cmInstallType_DIRECTORY, dirs, this->Optional,
|
||||
this->FilePermissions.c_str(),
|
||||
this->DirPermissions.c_str(), no_rename,
|
||||
this->DirPermissions.c_str(), noRename,
|
||||
this->LiteralArguments.c_str(), indent);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ 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::string filePermissions, std::string dirPermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string literal_args, bool optional, cmListFileBacktrace backtrace);
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
std::string literalArgs, bool optional, cmListFileBacktrace backtrace);
|
||||
~cmInstallDirectoryGenerator() override;
|
||||
|
||||
bool Compute(cmLocalGenerator* lg) override;
|
||||
|
||||
@@ -122,8 +122,8 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
||||
std::vector<std::string> files;
|
||||
for (auto const& i : this->EFGen->GetConfigImportFiles()) {
|
||||
files.push_back(i.second);
|
||||
std::string config_test = this->CreateConfigTest(i.first);
|
||||
os << indent << "if(" << config_test << ")\n";
|
||||
std::string configTest = this->CreateConfigTest(i.first);
|
||||
os << indent << "if(" << configTest << ")\n";
|
||||
this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files,
|
||||
false, this->FilePermissions.c_str(), nullptr,
|
||||
nullptr, nullptr, indent.Next());
|
||||
@@ -182,8 +182,8 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
||||
}
|
||||
for (auto const& i : this->EFGen->GetConfigCxxModuleFiles()) {
|
||||
files.push_back(i.second);
|
||||
std::string config_test = this->CreateConfigTest(i.first);
|
||||
os << indent << "if(" << config_test << ")\n";
|
||||
std::string configTest = this->CreateConfigTest(i.first);
|
||||
os << indent << "if(" << configTest << ")\n";
|
||||
this->AddInstallRule(os, cxxModuleDestination, cmInstallType_FILES, files,
|
||||
false, this->FilePermissions.c_str(), nullptr,
|
||||
nullptr, nullptr, indent.Next());
|
||||
@@ -191,8 +191,8 @@ void cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os,
|
||||
files.clear();
|
||||
}
|
||||
for (auto const& i : this->EFGen->GetConfigCxxModuleTargetFiles()) {
|
||||
std::string config_test = this->CreateConfigTest(i.first);
|
||||
os << indent << "if(" << config_test << ")\n";
|
||||
std::string configTest = this->CreateConfigTest(i.first);
|
||||
os << indent << "if(" << configTest << ")\n";
|
||||
this->AddInstallRule(os, cxxModuleDestination, cmInstallType_FILES,
|
||||
i.second, false, this->FilePermissions.c_str(),
|
||||
nullptr, nullptr, nullptr, indent.Next());
|
||||
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
cmInstallFileSetGenerator::cmInstallFileSetGenerator(
|
||||
std::string targetName, std::string fileSetName, std::string destination,
|
||||
std::string file_permissions, std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string filePermissions, std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
bool optional, cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(std::move(destination), configurations, component,
|
||||
message, exclude_from_all, false, std::move(backtrace))
|
||||
message, excludeFromAll, false, std::move(backtrace))
|
||||
, TargetName(std::move(targetName))
|
||||
, FileSetName(std::move(fileSetName))
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, FilePermissions(std::move(filePermissions))
|
||||
, Optional(optional)
|
||||
{
|
||||
this->ActionsPerConfig = true;
|
||||
|
||||
@@ -20,10 +20,10 @@ class cmInstallFileSetGenerator : public cmInstallGenerator
|
||||
public:
|
||||
cmInstallFileSetGenerator(std::string targetName, std::string fileSetName,
|
||||
std::string destination,
|
||||
std::string file_permissions,
|
||||
std::string filePermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message,
|
||||
bool exclude_from_all, bool optional,
|
||||
bool excludeFromAll, bool optional,
|
||||
cmListFileBacktrace backtrace);
|
||||
~cmInstallFileSetGenerator() override;
|
||||
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
cmInstallFilesGenerator::cmInstallFilesGenerator(
|
||||
std::vector<std::string> const& files, std::string const& dest,
|
||||
bool programs, std::string file_permissions,
|
||||
bool programs, std::string filePermissions,
|
||||
std::vector<std::string> const& configurations, std::string const& component,
|
||||
MessageLevel message, bool exclude_from_all, std::string rename,
|
||||
bool optional, cmListFileBacktrace backtrace)
|
||||
MessageLevel message, bool excludeFromAll, std::string rename, bool optional,
|
||||
cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all, false, std::move(backtrace))
|
||||
excludeFromAll, false, std::move(backtrace))
|
||||
, Files(files)
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, FilePermissions(std::move(filePermissions))
|
||||
, Rename(std::move(rename))
|
||||
, Programs(programs)
|
||||
, Optional(optional)
|
||||
@@ -86,11 +86,11 @@ void cmInstallFilesGenerator::AddFilesInstallRule(
|
||||
std::vector<std::string> const& files)
|
||||
{
|
||||
// Write code to install the files.
|
||||
char const* no_dir_permissions = nullptr;
|
||||
char const* noDirPermissions = nullptr;
|
||||
this->AddInstallRule(
|
||||
os, this->GetDestination(config),
|
||||
(this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), files,
|
||||
this->Optional, this->FilePermissions.c_str(), no_dir_permissions,
|
||||
this->Optional, this->FilePermissions.c_str(), noDirPermissions,
|
||||
this->GetRename(config).c_str(), nullptr, indent);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ class cmInstallFilesGenerator : public cmInstallGenerator
|
||||
public:
|
||||
cmInstallFilesGenerator(std::vector<std::string> const& files,
|
||||
std::string const& dest, bool programs,
|
||||
std::string file_permissions,
|
||||
std::string filePermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message,
|
||||
bool exclude_from_all, std::string rename,
|
||||
bool excludeFromAll, std::string rename,
|
||||
bool optional, cmListFileBacktrace backtrace);
|
||||
~cmInstallFilesGenerator() override;
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
cmInstallGenerator::cmInstallGenerator(
|
||||
std::string destination, std::vector<std::string> const& configurations,
|
||||
std::string component, MessageLevel message, bool exclude_from_all,
|
||||
bool all_components, cmListFileBacktrace backtrace)
|
||||
std::string component, MessageLevel message, bool excludeFromAll,
|
||||
bool allComponents, cmListFileBacktrace backtrace)
|
||||
: cmScriptGenerator("CMAKE_INSTALL_CONFIG_NAME", configurations)
|
||||
, Destination(std::move(destination))
|
||||
, Component(std::move(component))
|
||||
, Message(message)
|
||||
, ExcludeFromAll(exclude_from_all)
|
||||
, AllComponents(all_components)
|
||||
, ExcludeFromAll(excludeFromAll)
|
||||
, AllComponents(allComponents)
|
||||
, Backtrace(std::move(backtrace))
|
||||
{
|
||||
}
|
||||
@@ -46,10 +46,10 @@ void cmInstallGenerator::CheckCMP0082(bool& haveSubdirectoryInstall,
|
||||
void cmInstallGenerator::AddInstallRule(
|
||||
std::ostream& os, std::string const& dest, cmInstallType type,
|
||||
std::vector<std::string> const& files, bool optional /* = false */,
|
||||
char const* permissions_file /* = nullptr */,
|
||||
char const* permissions_dir /* = nullptr */,
|
||||
char const* rename /* = nullptr */, char const* literal_args /* = nullptr */,
|
||||
Indent indent, char const* files_var /* = nullptr */)
|
||||
char const* permissionsFile /* = nullptr */,
|
||||
char const* permissionsDir /* = nullptr */,
|
||||
char const* rename /* = nullptr */, char const* literalArgs /* = nullptr */,
|
||||
Indent indent, char const* filesVar /* = nullptr */)
|
||||
{
|
||||
// Use the FILE command to install the file.
|
||||
std::string stype;
|
||||
@@ -95,9 +95,8 @@ void cmInstallGenerator::AddInstallRule(
|
||||
}
|
||||
os << "\")\n";
|
||||
}
|
||||
if (files_var) {
|
||||
os << indent << "foreach(_cmake_abs_file IN LISTS " << files_var
|
||||
<< ")\n";
|
||||
if (filesVar) {
|
||||
os << indent << "foreach(_cmake_abs_file IN LISTS " << filesVar << ")\n";
|
||||
os << indent.Next()
|
||||
<< "get_filename_component(_cmake_abs_file_name "
|
||||
"\"${_cmake_abs_file}\" NAME)\n";
|
||||
@@ -139,11 +138,11 @@ void cmInstallGenerator::AddInstallRule(
|
||||
os << " MESSAGE_NEVER";
|
||||
break;
|
||||
}
|
||||
if (permissions_file && *permissions_file) {
|
||||
os << " PERMISSIONS" << permissions_file;
|
||||
if (permissionsFile && *permissionsFile) {
|
||||
os << " PERMISSIONS" << permissionsFile;
|
||||
}
|
||||
if (permissions_dir && *permissions_dir) {
|
||||
os << " DIR_PERMISSIONS" << permissions_dir;
|
||||
if (permissionsDir && *permissionsDir) {
|
||||
os << " DIR_PERMISSIONS" << permissionsDir;
|
||||
}
|
||||
if (rename && *rename) {
|
||||
os << " RENAME \"" << rename << "\"";
|
||||
@@ -155,25 +154,25 @@ void cmInstallGenerator::AddInstallRule(
|
||||
for (std::string const& f : files) {
|
||||
os << "\n" << indent << " \"" << f << "\"";
|
||||
}
|
||||
if (files_var) {
|
||||
os << " ${" << files_var << "}";
|
||||
if (filesVar) {
|
||||
os << " ${" << filesVar << "}";
|
||||
}
|
||||
os << "\n" << indent << " ";
|
||||
if (!(literal_args && *literal_args)) {
|
||||
if (!(literalArgs && *literalArgs)) {
|
||||
os << " ";
|
||||
}
|
||||
}
|
||||
if (literal_args && *literal_args) {
|
||||
os << literal_args;
|
||||
if (literalArgs && *literalArgs) {
|
||||
os << literalArgs;
|
||||
}
|
||||
os << ")\n";
|
||||
}
|
||||
|
||||
std::string cmInstallGenerator::CreateComponentTest(
|
||||
std::string const& component, bool exclude_from_all, bool all_components)
|
||||
std::string const& component, bool excludeFromAll, bool allComponents)
|
||||
{
|
||||
if (all_components) {
|
||||
if (exclude_from_all) {
|
||||
if (allComponents) {
|
||||
if (excludeFromAll) {
|
||||
return "CMAKE_INSTALL_COMPONENT";
|
||||
}
|
||||
return {};
|
||||
@@ -182,7 +181,7 @@ std::string cmInstallGenerator::CreateComponentTest(
|
||||
std::string result = "CMAKE_INSTALL_COMPONENT STREQUAL \"";
|
||||
result += component;
|
||||
result += "\"";
|
||||
if (!exclude_from_all) {
|
||||
if (!excludeFromAll) {
|
||||
result += " OR NOT CMAKE_INSTALL_COMPONENT";
|
||||
}
|
||||
|
||||
@@ -194,12 +193,12 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
|
||||
// Track indentation.
|
||||
Indent indent;
|
||||
|
||||
std::string component_test = this->CreateComponentTest(
|
||||
std::string componentTest = this->CreateComponentTest(
|
||||
this->Component, this->ExcludeFromAll, this->AllComponents);
|
||||
|
||||
// Begin this block of installation.
|
||||
if (!component_test.empty()) {
|
||||
os << indent << "if(" << component_test << ")\n";
|
||||
if (!componentTest.empty()) {
|
||||
os << indent << "if(" << componentTest << ")\n";
|
||||
}
|
||||
|
||||
// Generate the script possibly with per-configuration code.
|
||||
@@ -207,7 +206,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
|
||||
this->AllComponents ? indent : indent.Next());
|
||||
|
||||
// End this block of installation.
|
||||
if (!component_test.empty()) {
|
||||
if (!componentTest.empty()) {
|
||||
os << indent << "endif()\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
cmInstallGenerator(std::string destination,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string component, MessageLevel message,
|
||||
bool exclude_from_all, bool all_components,
|
||||
bool excludeFromAll, bool allComponents,
|
||||
cmListFileBacktrace backtrace);
|
||||
~cmInstallGenerator() override;
|
||||
|
||||
@@ -48,10 +48,10 @@ public:
|
||||
void AddInstallRule(
|
||||
std::ostream& os, std::string const& dest, cmInstallType type,
|
||||
std::vector<std::string> const& files, bool optional = false,
|
||||
char const* permissions_file = nullptr,
|
||||
char const* permissions_dir = nullptr, char const* rename = nullptr,
|
||||
char const* literal_args = nullptr, Indent indent = Indent(),
|
||||
char const* files_var = nullptr);
|
||||
char const* permissionsFile = nullptr,
|
||||
char const* permissionsDir = nullptr, char const* rename = nullptr,
|
||||
char const* literalArgs = nullptr, Indent indent = Indent(),
|
||||
char const* filesVar = nullptr);
|
||||
|
||||
/** Get the install destination as it should appear in the
|
||||
installation script. */
|
||||
@@ -81,8 +81,8 @@ protected:
|
||||
void GenerateScript(std::ostream& os) override;
|
||||
|
||||
std::string CreateComponentTest(std::string const& component,
|
||||
bool exclude_from_all,
|
||||
bool all_components = false);
|
||||
bool excludeFromAll,
|
||||
bool allComponents = false);
|
||||
|
||||
using TweakMethod =
|
||||
std::function<void(std::ostream& os, Indent indent,
|
||||
|
||||
@@ -84,10 +84,10 @@ cmInstallGetRuntimeDependenciesGenerator::
|
||||
std::vector<std::string> postExcludeFiles, std::string libraryComponent,
|
||||
std::string frameworkComponent, bool noInstallRPath, char const* depsVar,
|
||||
char const* rpathPrefix, std::vector<std::string> const& configurations,
|
||||
MessageLevel message, bool exclude_from_all, cmListFileBacktrace backtrace,
|
||||
MessageLevel message, bool excludeFromAll, cmListFileBacktrace backtrace,
|
||||
cmPolicies::PolicyStatus policyStatusCMP0207)
|
||||
: cmInstallGenerator("", configurations, "", message, exclude_from_all,
|
||||
false, std::move(backtrace))
|
||||
: cmInstallGenerator("", configurations, "", message, excludeFromAll, false,
|
||||
std::move(backtrace))
|
||||
, RuntimeDependencySet(runtimeDependencySet)
|
||||
, Directories(std::move(directories))
|
||||
, PreIncludeRegexes(std::move(preIncludeRegexes))
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
std::vector<std::string> postExcludeFiles, std::string libraryComponent,
|
||||
std::string frameworkComponent, bool noInstallRPath, char const* depsVar,
|
||||
char const* rpathPrefix, std::vector<std::string> const& configurations,
|
||||
MessageLevel message, bool exclude_from_all, cmListFileBacktrace backtrace,
|
||||
MessageLevel message, bool excludeFromAll, cmListFileBacktrace backtrace,
|
||||
cmPolicies::PolicyStatus policyStatusCMP0207);
|
||||
|
||||
bool Compute(cmLocalGenerator* lg) override;
|
||||
|
||||
@@ -32,14 +32,14 @@ cmsys::RegularExpression const CFBundleRegularExpression(
|
||||
cmInstallImportedRuntimeArtifactsGenerator::
|
||||
cmInstallImportedRuntimeArtifactsGenerator(
|
||||
std::string targetName, std::string const& dest,
|
||||
std::string file_permissions,
|
||||
std::string filePermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
bool optional, cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all, false, std::move(backtrace))
|
||||
excludeFromAll, false, std::move(backtrace))
|
||||
, TargetName(std::move(targetName))
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, FilePermissions(std::move(filePermissions))
|
||||
, Optional(optional)
|
||||
{
|
||||
this->ActionsPerConfig = true;
|
||||
|
||||
@@ -16,9 +16,9 @@ class cmInstallImportedRuntimeArtifactsGenerator : public cmInstallGenerator
|
||||
public:
|
||||
cmInstallImportedRuntimeArtifactsGenerator(
|
||||
std::string targetName, std::string const& dest,
|
||||
std::string file_permissions,
|
||||
std::string filePermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
bool optional, cmListFileBacktrace backtrace = cmListFileBacktrace());
|
||||
~cmInstallImportedRuntimeArtifactsGenerator() override = default;
|
||||
|
||||
|
||||
@@ -48,18 +48,18 @@ bool cmInstallProgramsCommand(std::vector<std::string> const& args,
|
||||
static void FinalAction(cmMakefile& makefile, std::string const& dest,
|
||||
std::vector<std::string> const& args)
|
||||
{
|
||||
bool files_mode = false;
|
||||
bool filesMode = false;
|
||||
if (!args.empty() && args[0] == "FILES") {
|
||||
files_mode = true;
|
||||
filesMode = true;
|
||||
}
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
||||
// two different options
|
||||
if (args.size() > 1 || files_mode) {
|
||||
if (args.size() > 1 || filesMode) {
|
||||
// for each argument, get the programs
|
||||
auto s = args.begin();
|
||||
if (files_mode) {
|
||||
if (filesMode) {
|
||||
// Skip the FILES argument in files mode.
|
||||
++s;
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ cmInstallRuntimeDependencySetGenerator::cmInstallRuntimeDependencySetGenerator(
|
||||
std::string installNameDir, bool noInstallName, char const* depsVar,
|
||||
char const* rpathPrefix, char const* tmpVarPrefix, std::string destination,
|
||||
std::vector<std::string> const& configurations, std::string component,
|
||||
std::string permissions, MessageLevel message, bool exclude_from_all,
|
||||
std::string permissions, MessageLevel message, bool excludeFromAll,
|
||||
cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(std::move(destination), configurations,
|
||||
std::move(component), message, exclude_from_all, false,
|
||||
std::move(component), message, excludeFromAll, false,
|
||||
std::move(backtrace))
|
||||
, Type(type)
|
||||
, DependencySet(dependencySet)
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
std::string installNameDir, bool noInstallName, char const* depsVar,
|
||||
char const* rpathPrefix, char const* tmpVarPrefix, std::string destination,
|
||||
std::vector<std::string> const& configurations, std::string component,
|
||||
std::string permissions, MessageLevel message, bool exclude_from_all,
|
||||
std::string permissions, MessageLevel message, bool excludeFromAll,
|
||||
cmListFileBacktrace backtrace);
|
||||
|
||||
bool Compute(cmLocalGenerator* lg) override;
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
cmInstallScriptGenerator::cmInstallScriptGenerator(
|
||||
std::string script, bool code, std::string const& component,
|
||||
bool exclude_from_all, bool all_components, cmListFileBacktrace backtrace)
|
||||
bool excludeFromAll, bool allComponents, cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator("", std::vector<std::string>(), component,
|
||||
MessageDefault, exclude_from_all, all_components,
|
||||
MessageDefault, excludeFromAll, allComponents,
|
||||
std::move(backtrace))
|
||||
, Script(std::move(script))
|
||||
, Code(code)
|
||||
|
||||
@@ -20,7 +20,7 @@ class cmInstallScriptGenerator : public cmInstallGenerator
|
||||
public:
|
||||
cmInstallScriptGenerator(
|
||||
std::string script, bool code, std::string const& component,
|
||||
bool exclude_from_all, bool all_components,
|
||||
bool excludeFromAll, bool allComponents,
|
||||
cmListFileBacktrace backtrace = cmListFileBacktrace());
|
||||
~cmInstallScriptGenerator() override;
|
||||
|
||||
|
||||
@@ -34,86 +34,86 @@ using InstallScript = cmInstallScriptHandler::InstallScript;
|
||||
using InstallScriptRunner = cmInstallScriptHandler::InstallScriptRunner;
|
||||
|
||||
cmInstallScriptHandler::cmInstallScriptHandler(
|
||||
std::string _binaryDir, std::vector<std::string> _components,
|
||||
std::string _config, std::vector<std::string>& args)
|
||||
: components(std::move(_components))
|
||||
, binaryDir(std::move(_binaryDir))
|
||||
std::string binaryDir, std::vector<std::string> components,
|
||||
std::string installConfig, std::vector<std::string>& args)
|
||||
: Components(std::move(components))
|
||||
, BinaryDir(std::move(binaryDir))
|
||||
{
|
||||
if (this->components.empty()) {
|
||||
this->components.emplace_back(std::string{});
|
||||
if (this->Components.empty()) {
|
||||
this->Components.emplace_back(std::string{});
|
||||
}
|
||||
|
||||
std::string const& file =
|
||||
cmStrCat(this->binaryDir, "/CMakeFiles/InstallScripts.json");
|
||||
this->parallel = false;
|
||||
cmStrCat(this->BinaryDir, "/CMakeFiles/InstallScripts.json");
|
||||
this->Parallel = false;
|
||||
|
||||
auto addScript = [this, &args](std::string script, std::string component,
|
||||
std::string config) -> void {
|
||||
this->scripts.push_back({ script, config, args });
|
||||
this->Scripts.push_back({ script, config, args });
|
||||
if (!component.empty()) {
|
||||
this->scripts.back().command.insert(
|
||||
this->scripts.back().command.end() - 1,
|
||||
this->Scripts.back().command.insert(
|
||||
this->Scripts.back().command.end() - 1,
|
||||
cmStrCat("-DCMAKE_INSTALL_COMPONENT=", component));
|
||||
}
|
||||
if (!config.empty()) {
|
||||
this->scripts.back().command.insert(
|
||||
this->scripts.back().command.end() - 1,
|
||||
this->Scripts.back().command.insert(
|
||||
this->Scripts.back().command.end() - 1,
|
||||
cmStrCat("-DCMAKE_INSTALL_CONFIG_NAME=", config));
|
||||
}
|
||||
this->scripts.back().command.emplace_back(script);
|
||||
this->directories.push_back(cmSystemTools::GetFilenamePath(script));
|
||||
this->Scripts.back().command.emplace_back(script);
|
||||
this->Directories.push_back(cmSystemTools::GetFilenamePath(script));
|
||||
};
|
||||
|
||||
int compare = 1;
|
||||
if (cmSystemTools::FileExists(file)) {
|
||||
cmSystemTools::FileTimeCompare(
|
||||
cmStrCat(this->binaryDir, "/CMakeFiles/cmake.check_cache"), file,
|
||||
cmStrCat(this->BinaryDir, "/CMakeFiles/cmake.check_cache"), file,
|
||||
&compare);
|
||||
}
|
||||
if (compare < 1) {
|
||||
Json::CharReaderBuilder rbuilder;
|
||||
auto JsonReader =
|
||||
auto jsonReader =
|
||||
std::unique_ptr<Json::CharReader>(rbuilder.newCharReader());
|
||||
std::vector<char> content;
|
||||
Json::Value value;
|
||||
cmJSONState state(file, &value);
|
||||
this->parallel = value["Parallel"].asBool();
|
||||
if (this->parallel) {
|
||||
this->Parallel = value["Parallel"].asBool();
|
||||
if (this->Parallel) {
|
||||
args.insert(args.end() - 1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
|
||||
}
|
||||
if (_config.empty() && value.isMember("Configs")) {
|
||||
if (installConfig.empty() && value.isMember("Configs")) {
|
||||
for (auto const& config : value["Configs"]) {
|
||||
this->configs.push_back(config.asCString());
|
||||
this->Configs.push_back(config.asCString());
|
||||
}
|
||||
} else {
|
||||
this->configs.push_back(_config);
|
||||
this->Configs.push_back(installConfig);
|
||||
}
|
||||
for (auto const& script : value["InstallScripts"]) {
|
||||
for (auto const& component : components) {
|
||||
for (auto const& config : configs) {
|
||||
for (auto const& component : Components) {
|
||||
for (auto const& config : Configs) {
|
||||
addScript(script.asCString(), component, config);
|
||||
}
|
||||
}
|
||||
if (!this->parallel) {
|
||||
if (!this->Parallel) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto const& component : components) {
|
||||
addScript(cmStrCat(this->binaryDir, "/cmake_install.cmake"), component,
|
||||
_config);
|
||||
for (auto const& component : Components) {
|
||||
addScript(cmStrCat(this->BinaryDir, "/cmake_install.cmake"), component,
|
||||
installConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool cmInstallScriptHandler::IsParallel()
|
||||
{
|
||||
return this->parallel;
|
||||
return this->Parallel;
|
||||
}
|
||||
|
||||
std::vector<InstallScript> cmInstallScriptHandler::GetScripts() const
|
||||
{
|
||||
return this->scripts;
|
||||
return this->Scripts;
|
||||
}
|
||||
|
||||
int cmInstallScriptHandler::Install(unsigned int j,
|
||||
@@ -122,27 +122,27 @@ int cmInstallScriptHandler::Install(unsigned int j,
|
||||
cm::uv_loop_ptr loop;
|
||||
loop.init();
|
||||
std::vector<InstallScriptRunner> runners;
|
||||
runners.reserve(this->scripts.size());
|
||||
runners.reserve(this->Scripts.size());
|
||||
|
||||
std::vector<std::string> instrument_arg;
|
||||
std::vector<std::string> instrumentArg;
|
||||
if (instrumentation.HasQuery()) {
|
||||
instrument_arg = { cmSystemTools::GetCTestCommand(),
|
||||
"--instrument",
|
||||
"--command-type",
|
||||
"install",
|
||||
"--build-dir",
|
||||
this->binaryDir,
|
||||
"--config",
|
||||
"",
|
||||
"--" };
|
||||
instrumentArg = { cmSystemTools::GetCTestCommand(),
|
||||
"--instrument",
|
||||
"--command-type",
|
||||
"install",
|
||||
"--build-dir",
|
||||
this->BinaryDir,
|
||||
"--config",
|
||||
"",
|
||||
"--" };
|
||||
}
|
||||
|
||||
for (auto& script : this->scripts) {
|
||||
if (!instrument_arg.empty()) {
|
||||
instrument_arg[7] = script.config; // --config <script.config>
|
||||
for (auto& script : this->Scripts) {
|
||||
if (!instrumentArg.empty()) {
|
||||
instrumentArg[7] = script.config; // --config <script.config>
|
||||
}
|
||||
script.command.insert(script.command.begin(), instrument_arg.begin(),
|
||||
instrument_arg.end());
|
||||
script.command.insert(script.command.begin(), instrumentArg.begin(),
|
||||
instrumentArg.end());
|
||||
runners.emplace_back(script);
|
||||
}
|
||||
std::size_t working = 0;
|
||||
@@ -168,28 +168,28 @@ int cmInstallScriptHandler::Install(unsigned int j,
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
|
||||
// Write install manifest
|
||||
std::string install_manifest;
|
||||
for (auto const& component : this->components) {
|
||||
std::string installManifest;
|
||||
for (auto const& component : this->Components) {
|
||||
if (component.empty()) {
|
||||
install_manifest = "install_manifest.txt";
|
||||
installManifest = "install_manifest.txt";
|
||||
} else {
|
||||
cmsys::RegularExpression regEntry;
|
||||
if (regEntry.compile("^[a-zA-Z0-9_.+-]+$") && regEntry.find(component)) {
|
||||
install_manifest = cmStrCat("install_manifest_", component, ".txt");
|
||||
installManifest = cmStrCat("install_manifest_", component, ".txt");
|
||||
} else {
|
||||
cmCryptoHash md5(cmCryptoHash::AlgoMD5);
|
||||
md5.Initialize();
|
||||
install_manifest =
|
||||
installManifest =
|
||||
cmStrCat("install_manifest_", md5.HashString(component), ".txt");
|
||||
}
|
||||
}
|
||||
cmGeneratedFileStream fout(
|
||||
cmStrCat(this->binaryDir, '/', install_manifest));
|
||||
cmStrCat(this->BinaryDir, '/', installManifest));
|
||||
fout.SetCopyIfDifferent(true);
|
||||
for (auto const& dir : this->directories) {
|
||||
auto local_manifest = cmStrCat(dir, "/install_local_manifest.txt");
|
||||
if (cmSystemTools::FileExists(local_manifest)) {
|
||||
cmsys::ifstream fin(local_manifest.c_str());
|
||||
for (auto const& dir : this->Directories) {
|
||||
auto localManifest = cmStrCat(dir, "/install_local_manifest.txt");
|
||||
if (cmSystemTools::FileExists(localManifest)) {
|
||||
cmsys::ifstream fin(localManifest.c_str());
|
||||
std::string line;
|
||||
while (std::getline(fin, line)) {
|
||||
fout << line << "\n";
|
||||
@@ -202,34 +202,34 @@ int cmInstallScriptHandler::Install(unsigned int j,
|
||||
|
||||
InstallScriptRunner::InstallScriptRunner(InstallScript const& script)
|
||||
{
|
||||
this->name = cmSystemTools::RelativePath(
|
||||
this->Name = cmSystemTools::RelativePath(
|
||||
cmSystemTools::GetLogicalWorkingDirectory(), script.path);
|
||||
this->command = script.command;
|
||||
this->Command = script.command;
|
||||
}
|
||||
|
||||
void InstallScriptRunner::start(cm::uv_loop_ptr& loop,
|
||||
std::function<void()> callback)
|
||||
{
|
||||
cmUVProcessChainBuilder builder;
|
||||
builder.AddCommand(this->command)
|
||||
builder.AddCommand(this->Command)
|
||||
.SetExternalLoop(*loop)
|
||||
.SetMergedBuiltinStreams();
|
||||
this->chain = cm::make_unique<cmUVProcessChain>(builder.Start());
|
||||
this->streamHandler = cmUVStreamRead(
|
||||
this->chain->OutputStream(),
|
||||
this->Chain = cm::make_unique<cmUVProcessChain>(builder.Start());
|
||||
this->StreamHandler = cmUVStreamRead(
|
||||
this->Chain->OutputStream(),
|
||||
[this](std::vector<char> data) {
|
||||
std::string strdata;
|
||||
cmProcessOutput(cmProcessOutput::Auto)
|
||||
.DecodeText(data.data(), data.size(), strdata);
|
||||
this->output.push_back(strdata);
|
||||
this->Output.push_back(strdata);
|
||||
},
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
void InstallScriptRunner::printResult(std::size_t n, std::size_t total)
|
||||
{
|
||||
cmSystemTools::Stdout(cmStrCat('[', n, '/', total, "] ", this->name, '\n'));
|
||||
for (auto const& line : this->output) {
|
||||
cmSystemTools::Stdout(cmStrCat('[', n, '/', total, "] ", this->Name, '\n'));
|
||||
for (auto const& line : this->Output) {
|
||||
cmSystemTools::Stdout(line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,18 +40,18 @@ public:
|
||||
void printResult(std::size_t n, std::size_t total);
|
||||
|
||||
private:
|
||||
std::vector<std::string> command;
|
||||
std::vector<std::string> output;
|
||||
std::string name;
|
||||
std::unique_ptr<cmUVProcessChain> chain;
|
||||
std::unique_ptr<cmUVStreamReadHandle> streamHandler;
|
||||
std::vector<std::string> Command;
|
||||
std::vector<std::string> Output;
|
||||
std::string Name;
|
||||
std::unique_ptr<cmUVProcessChain> Chain;
|
||||
std::unique_ptr<cmUVStreamReadHandle> StreamHandler;
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<InstallScript> scripts;
|
||||
std::vector<std::string> configs;
|
||||
std::vector<std::string> directories;
|
||||
std::vector<std::string> components;
|
||||
std::string binaryDir;
|
||||
bool parallel;
|
||||
std::vector<InstallScript> Scripts;
|
||||
std::vector<std::string> Configs;
|
||||
std::vector<std::string> Directories;
|
||||
std::vector<std::string> Components;
|
||||
std::string BinaryDir;
|
||||
bool Parallel;
|
||||
};
|
||||
|
||||
@@ -128,13 +128,13 @@ void computeFilesToInstall(
|
||||
|
||||
cmInstallTargetGenerator::cmInstallTargetGenerator(
|
||||
std::string targetName, std::string const& dest, bool implib,
|
||||
std::string file_permissions, std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string filePermissions, std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
bool optional, cmListFileBacktrace backtrace)
|
||||
: cmInstallGenerator(dest, configurations, component, message,
|
||||
exclude_from_all, false, std::move(backtrace))
|
||||
excludeFromAll, false, std::move(backtrace))
|
||||
, TargetName(std::move(targetName))
|
||||
, FilePermissions(std::move(file_permissions))
|
||||
, FilePermissions(std::move(filePermissions))
|
||||
, ImportLibrary(implib)
|
||||
, Optional(optional)
|
||||
{
|
||||
@@ -177,9 +177,9 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
|
||||
// Write code to install the target file.
|
||||
char const* no_dir_permissions = nullptr;
|
||||
bool optional = this->Optional || this->ImportLibrary;
|
||||
std::string literal_args;
|
||||
std::string literalArgs;
|
||||
if (files.UseSourcePermissions) {
|
||||
literal_args += " USE_SOURCE_PERMISSIONS";
|
||||
literalArgs += " USE_SOURCE_PERMISSIONS";
|
||||
}
|
||||
if (files.Rename) {
|
||||
if (files.From.size() != files.To.size()) {
|
||||
@@ -199,16 +199,16 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
|
||||
}
|
||||
this->AddInstallRule(os, dest, files.Type, FileNames, optional,
|
||||
this->FilePermissions.c_str(), no_dir_permissions,
|
||||
files.To[i].c_str(), literal_args.c_str(), indent);
|
||||
files.To[i].c_str(), literalArgs.c_str(), indent);
|
||||
}
|
||||
} else {
|
||||
char const* no_rename = nullptr;
|
||||
if (!files.FromDir.empty()) {
|
||||
literal_args += " FILES_FROM_DIR \"" + files.FromDir + "\"";
|
||||
literalArgs += " FILES_FROM_DIR \"" + files.FromDir + "\"";
|
||||
}
|
||||
this->AddInstallRule(os, dest, files.Type, files.From, optional,
|
||||
this->FilePermissions.c_str(), no_dir_permissions,
|
||||
no_rename, literal_args.c_str(), indent);
|
||||
no_rename, literalArgs.c_str(), indent);
|
||||
}
|
||||
|
||||
// Add post-installation tweaks.
|
||||
|
||||
@@ -22,9 +22,9 @@ class cmInstallTargetGenerator : public cmInstallGenerator
|
||||
public:
|
||||
cmInstallTargetGenerator(
|
||||
std::string targetName, std::string const& dest, bool implib,
|
||||
std::string file_permissions,
|
||||
std::string filePermissions,
|
||||
std::vector<std::string> const& configurations,
|
||||
std::string const& component, MessageLevel message, bool exclude_from_all,
|
||||
std::string const& component, MessageLevel message, bool excludeFromAll,
|
||||
bool optional, cmListFileBacktrace backtrace = cmListFileBacktrace());
|
||||
~cmInstallTargetGenerator() override;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ bool cmInstallTargetsCommand(std::vector<std::string> const& args,
|
||||
cmMakefile::cmTargetMap& tgts = mf.GetTargets();
|
||||
auto s = args.begin();
|
||||
++s;
|
||||
std::string runtime_dir = "/bin";
|
||||
std::string runtimeDir = "/bin";
|
||||
for (; s != args.end(); ++s) {
|
||||
if (*s == "RUNTIME_DIRECTORY") {
|
||||
++s;
|
||||
@@ -36,12 +36,12 @@ bool cmInstallTargetsCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
runtime_dir = *s;
|
||||
runtimeDir = *s;
|
||||
} else {
|
||||
auto ti = tgts.find(*s);
|
||||
if (ti != tgts.end()) {
|
||||
ti->second.SetInstallPath(args[0]);
|
||||
ti->second.SetRuntimeInstallPath(runtime_dir);
|
||||
ti->second.SetRuntimeInstallPath(runtimeDir);
|
||||
ti->second.SetHaveInstallRule(true);
|
||||
} else {
|
||||
std::string str = "Cannot find target: \"" + *s + "\" to install.";
|
||||
|
||||
Reference in New Issue
Block a user