summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r--Source/cmFileCommand.cxx493
1 files changed, 334 insertions, 159 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 4a28238..1223d2a 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -31,6 +31,7 @@
#include "cmArgumentParser.h"
#include "cmCMakePath.h"
#include "cmCryptoHash.h"
+#include "cmELF.h"
#include "cmExecutionStatus.h"
#include "cmFSPermissions.h"
#include "cmFileCopier.h"
@@ -64,41 +65,8 @@
# include "cmFileLockResult.h"
#endif
-#if defined(CMake_USE_ELF_PARSER)
-# include "cmELF.h"
-#endif
-
-#if defined(_WIN32)
-# include <windows.h>
-#endif
-
namespace {
-#if defined(_WIN32)
-// libcurl doesn't support file:// urls for unicode filenames on Windows.
-// Convert string from UTF-8 to ACP if this is a file:// URL.
-std::string fix_file_url_windows(const std::string& url)
-{
- std::string ret = url;
- if (strncmp(url.c_str(), "file://", 7) == 0) {
- std::wstring wurl = cmsys::Encoding::ToWide(url);
- if (!wurl.empty()) {
- int mblen =
- WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, NULL, 0, NULL, NULL);
- if (mblen > 0) {
- std::vector<char> chars(mblen);
- mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, &chars[0],
- mblen, NULL, NULL);
- if (mblen > 0) {
- ret = &chars[0];
- }
- }
- }
- }
- return ret;
-}
-#endif
-
bool HandleWriteImpl(std::vector<std::string> const& args, bool append,
cmExecutionStatus& status)
{
@@ -990,50 +958,42 @@ bool HandleRPathChangeCommand(std::vector<std::string> const& args,
{
// Evaluate arguments.
std::string file;
- const char* oldRPath = nullptr;
- const char* newRPath = nullptr;
+ std::string oldRPath;
+ std::string newRPath;
bool removeEnvironmentRPath = false;
- enum Doing
- {
- DoingNone,
- DoingFile,
- DoingOld,
- DoingNew
- };
- Doing doing = DoingNone;
- for (unsigned int i = 1; i < args.size(); ++i) {
- if (args[i] == "OLD_RPATH") {
- doing = DoingOld;
- } else if (args[i] == "NEW_RPATH") {
- doing = DoingNew;
- } else if (args[i] == "FILE") {
- doing = DoingFile;
- } else if (args[i] == "INSTALL_REMOVE_ENVIRONMENT_RPATH") {
- removeEnvironmentRPath = true;
- } else if (doing == DoingFile) {
- file = args[i];
- doing = DoingNone;
- } else if (doing == DoingOld) {
- oldRPath = args[i].c_str();
- doing = DoingNone;
- } else if (doing == DoingNew) {
- newRPath = args[i].c_str();
- doing = DoingNone;
- } else {
- status.SetError(
- cmStrCat("RPATH_CHANGE given unknown argument ", args[i]));
- return false;
- }
+ cmArgumentParser<void> parser;
+ std::vector<std::string> unknownArgs;
+ std::vector<std::string> missingArgs;
+ std::vector<std::string> parsedArgs;
+ parser.Bind("FILE"_s, file)
+ .Bind("OLD_RPATH"_s, oldRPath)
+ .Bind("NEW_RPATH"_s, newRPath)
+ .Bind("INSTALL_REMOVE_ENVIRONMENT_RPATH"_s, removeEnvironmentRPath);
+ parser.Parse(cmMakeRange(args).advance(1), &unknownArgs, &missingArgs,
+ &parsedArgs);
+ if (!unknownArgs.empty()) {
+ status.SetError(
+ cmStrCat("RPATH_CHANGE given unknown argument ", unknownArgs.front()));
+ return false;
+ }
+ if (!missingArgs.empty()) {
+ status.SetError(cmStrCat("RPATH_CHANGE \"", missingArgs.front(),
+ "\" argument not given value."));
+ return false;
}
if (file.empty()) {
status.SetError("RPATH_CHANGE not given FILE option.");
return false;
}
- if (!oldRPath) {
+ if (oldRPath.empty() &&
+ std::find(parsedArgs.begin(), parsedArgs.end(), "OLD_RPATH") ==
+ parsedArgs.end()) {
status.SetError("RPATH_CHANGE not given OLD_RPATH option.");
return false;
}
- if (!newRPath) {
+ if (newRPath.empty() &&
+ std::find(parsedArgs.begin(), parsedArgs.end(), "NEW_RPATH") ==
+ parsedArgs.end()) {
status.SetError("RPATH_CHANGE not given NEW_RPATH option.");
return false;
}
@@ -1065,28 +1025,85 @@ bool HandleRPathChangeCommand(std::vector<std::string> const& args,
return success;
}
+bool HandleRPathSetCommand(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
+{
+ // Evaluate arguments.
+ std::string file;
+ std::string newRPath;
+ cmArgumentParser<void> parser;
+ std::vector<std::string> unknownArgs;
+ std::vector<std::string> missingArgs;
+ std::vector<std::string> parsedArgs;
+ parser.Bind("FILE"_s, file).Bind("NEW_RPATH"_s, newRPath);
+ parser.Parse(cmMakeRange(args).advance(1), &unknownArgs, &missingArgs,
+ &parsedArgs);
+ if (!unknownArgs.empty()) {
+ status.SetError(cmStrCat("RPATH_SET given unrecognized argument \"",
+ unknownArgs.front(), "\"."));
+ return false;
+ }
+ if (!missingArgs.empty()) {
+ status.SetError(cmStrCat("RPATH_SET \"", missingArgs.front(),
+ "\" argument not given value."));
+ return false;
+ }
+ if (file.empty()) {
+ status.SetError("RPATH_SET not given FILE option.");
+ return false;
+ }
+ if (newRPath.empty() &&
+ std::find(parsedArgs.begin(), parsedArgs.end(), "NEW_RPATH") ==
+ parsedArgs.end()) {
+ status.SetError("RPATH_SET not given NEW_RPATH option.");
+ return false;
+ }
+ if (!cmSystemTools::FileExists(file, true)) {
+ status.SetError(
+ cmStrCat("RPATH_SET given FILE \"", file, "\" that does not exist."));
+ return false;
+ }
+ bool success = true;
+ cmFileTimes const ft(file);
+ std::string emsg;
+ bool changed;
+
+ if (!cmSystemTools::SetRPath(file, newRPath, &emsg, &changed)) {
+ status.SetError(cmStrCat("RPATH_SET could not write new RPATH:\n ",
+ newRPath, "\nto the file:\n ", file, "\n",
+ emsg));
+ success = false;
+ }
+ if (success) {
+ if (changed) {
+ std::string message =
+ cmStrCat("Set runtime path of \"", file, "\" to \"", newRPath, '"');
+ status.GetMakefile().DisplayStatus(message, -1);
+ }
+ ft.Store(file);
+ }
+ return success;
+}
+
bool HandleRPathRemoveCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
// Evaluate arguments.
std::string file;
- enum Doing
- {
- DoingNone,
- DoingFile
- };
- Doing doing = DoingNone;
- for (unsigned int i = 1; i < args.size(); ++i) {
- if (args[i] == "FILE") {
- doing = DoingFile;
- } else if (doing == DoingFile) {
- file = args[i];
- doing = DoingNone;
- } else {
- status.SetError(
- cmStrCat("RPATH_REMOVE given unknown argument ", args[i]));
- return false;
- }
+ cmArgumentParser<void> parser;
+ std::vector<std::string> unknownArgs;
+ std::vector<std::string> missingArgs;
+ parser.Bind("FILE"_s, file);
+ parser.Parse(cmMakeRange(args).advance(1), &unknownArgs, &missingArgs);
+ if (!unknownArgs.empty()) {
+ status.SetError(
+ cmStrCat("RPATH_REMOVE given unknown argument ", unknownArgs.front()));
+ return false;
+ }
+ if (!missingArgs.empty()) {
+ status.SetError(cmStrCat("RPATH_REMOVE \"", missingArgs.front(),
+ "\" argument not given value."));
+ return false;
}
if (file.empty()) {
status.SetError("RPATH_REMOVE not given FILE option.");
@@ -1123,36 +1140,31 @@ bool HandleRPathCheckCommand(std::vector<std::string> const& args,
{
// Evaluate arguments.
std::string file;
- const char* rpath = nullptr;
- enum Doing
- {
- DoingNone,
- DoingFile,
- DoingRPath
- };
- Doing doing = DoingNone;
- for (unsigned int i = 1; i < args.size(); ++i) {
- if (args[i] == "RPATH") {
- doing = DoingRPath;
- } else if (args[i] == "FILE") {
- doing = DoingFile;
- } else if (doing == DoingFile) {
- file = args[i];
- doing = DoingNone;
- } else if (doing == DoingRPath) {
- rpath = args[i].c_str();
- doing = DoingNone;
- } else {
- status.SetError(
- cmStrCat("RPATH_CHECK given unknown argument ", args[i]));
- return false;
- }
+ std::string rpath;
+ cmArgumentParser<void> parser;
+ std::vector<std::string> unknownArgs;
+ std::vector<std::string> missingArgs;
+ std::vector<std::string> parsedArgs;
+ parser.Bind("FILE"_s, file).Bind("RPATH"_s, rpath);
+ parser.Parse(cmMakeRange(args).advance(1), &unknownArgs, &missingArgs,
+ &parsedArgs);
+ if (!unknownArgs.empty()) {
+ status.SetError(
+ cmStrCat("RPATH_CHECK given unknown argument ", unknownArgs.front()));
+ return false;
+ }
+ if (!missingArgs.empty()) {
+ status.SetError(cmStrCat("RPATH_CHECK \"", missingArgs.front(),
+ "\" argument not given value."));
+ return false;
}
if (file.empty()) {
status.SetError("RPATH_CHECK not given FILE option.");
return false;
}
- if (!rpath) {
+ if (rpath.empty() &&
+ std::find(parsedArgs.begin(), parsedArgs.end(), "RPATH") ==
+ parsedArgs.end()) {
status.SetError("RPATH_CHECK not given RPATH option.");
return false;
}
@@ -1198,8 +1210,12 @@ bool HandleReadElfCommand(std::vector<std::string> const& args,
return false;
}
-#if defined(CMake_USE_ELF_PARSER)
cmELF elf(fileNameArg.c_str());
+ if (!elf) {
+ status.SetError(cmStrCat("READ_ELF given FILE \"", fileNameArg,
+ "\" that is not a valid ELF file."));
+ return false;
+ }
if (!arguments.RPath.empty()) {
if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
@@ -1217,15 +1233,6 @@ bool HandleReadElfCommand(std::vector<std::string> const& args,
}
return true;
-#else
- std::string error = "ELF parser not available on this platform.";
- if (arguments.Error.empty()) {
- status.SetError(error);
- return false;
- }
- status.GetMakefile().AddDefinition(arguments.Error, error);
- return true;
-#endif
}
bool HandleInstallCommand(std::vector<std::string> const& args,
@@ -1246,9 +1253,12 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
struct Arguments
{
std::string BaseDirectory;
+ bool ExpandTilde = false;
};
- static auto const parser = cmArgumentParser<Arguments>{}.Bind(
- "BASE_DIRECTORY"_s, &Arguments::BaseDirectory);
+ static auto const parser =
+ cmArgumentParser<Arguments>{}
+ .Bind("BASE_DIRECTORY"_s, &Arguments::BaseDirectory)
+ .Bind("EXPAND_TILDE"_s, &Arguments::ExpandTilde);
std::vector<std::string> unparsedArguments;
std::vector<std::string> keywordsMissingValue;
@@ -1270,7 +1280,21 @@ bool HandleRealPathCommand(std::vector<std::string> const& args,
arguments.BaseDirectory = status.GetMakefile().GetCurrentSourceDirectory();
}
- cmCMakePath path(args[1]);
+ auto input = args[1];
+ if (arguments.ExpandTilde && !input.empty()) {
+ if (input[0] == '~' && (input.length() == 1 || input[1] == '/')) {
+ std::string home;
+ if (
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ cmSystemTools::GetEnv("USERPROFILE", home) ||
+#endif
+ cmSystemTools::GetEnv("HOME", home)) {
+ input.replace(0, 1, home);
+ }
+ }
+ }
+
+ cmCMakePath path(input, cmCMakePath::auto_format);
path = path.Absolute(arguments.BaseDirectory).Normal();
auto realPath = cmSystemTools::GetRealPath(path.GenericString());
@@ -1313,8 +1337,9 @@ bool HandleRelativePathCommand(std::vector<std::string> const& args,
bool HandleRename(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- if (args.size() != 3) {
- status.SetError("RENAME given incorrect number of arguments.");
+ if (args.size() < 3) {
+ status.SetError("RENAME must be called with at least two additional "
+ "arguments");
return false;
}
@@ -1330,21 +1355,148 @@ bool HandleRename(std::vector<std::string> const& args,
cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[2]);
}
- if (!cmSystemTools::RenameFile(oldname, newname)) {
- std::string err = cmSystemTools::GetLastSystemError();
- status.SetError(cmStrCat("RENAME failed to rename\n ", oldname,
- "\nto\n ", newname, "\nbecause: ", err, "\n"));
+ struct Arguments
+ {
+ bool NoReplace = false;
+ std::string Result;
+ };
+
+ static auto const parser = cmArgumentParser<Arguments>{}
+ .Bind("NO_REPLACE"_s, &Arguments::NoReplace)
+ .Bind("RESULT"_s, &Arguments::Result);
+
+ std::vector<std::string> unconsumedArgs;
+ Arguments const arguments =
+ parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs);
+ if (!unconsumedArgs.empty()) {
+ status.SetError("RENAME unknown argument:\n " + unconsumedArgs.front());
return false;
}
- return true;
+
+ std::string err;
+ switch (cmSystemTools::RenameFile(oldname, newname,
+ arguments.NoReplace
+ ? cmSystemTools::Replace::No
+ : cmSystemTools::Replace::Yes,
+ &err)) {
+ case cmSystemTools::RenameResult::Success:
+ if (!arguments.Result.empty()) {
+ status.GetMakefile().AddDefinition(arguments.Result, "0");
+ }
+ return true;
+ case cmSystemTools::RenameResult::NoReplace:
+ if (!arguments.Result.empty()) {
+ err = "NO_REPLACE";
+ } else {
+ err = "path not replaced";
+ }
+ CM_FALLTHROUGH;
+ case cmSystemTools::RenameResult::Failure:
+ if (!arguments.Result.empty()) {
+ status.GetMakefile().AddDefinition(arguments.Result, err);
+ return true;
+ }
+ break;
+ }
+ status.SetError(cmStrCat("RENAME failed to rename\n ", oldname, "\nto\n ",
+ newname, "\nbecause: ", err, "\n"));
+ return false;
}
-bool HandleRemoveImpl(std::vector<std::string> const& args, bool recurse,
- cmExecutionStatus& status)
+bool HandleCopyFile(std::vector<std::string> const& args,
+ cmExecutionStatus& status)
{
+ if (args.size() < 3) {
+ status.SetError("COPY_FILE must be called with at least two additional "
+ "arguments");
+ return false;
+ }
- std::string message;
+ // Compute full path for old and new names.
+ std::string oldname = args[1];
+ if (!cmsys::SystemTools::FileIsFullPath(oldname)) {
+ oldname =
+ cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[1]);
+ }
+ std::string newname = args[2];
+ if (!cmsys::SystemTools::FileIsFullPath(newname)) {
+ newname =
+ cmStrCat(status.GetMakefile().GetCurrentSourceDirectory(), '/', args[2]);
+ }
+ struct Arguments
+ {
+ bool OnlyIfDifferent = false;
+ std::string Result;
+ };
+
+ static auto const parser =
+ cmArgumentParser<Arguments>{}
+ .Bind("ONLY_IF_DIFFERENT"_s, &Arguments::OnlyIfDifferent)
+ .Bind("RESULT"_s, &Arguments::Result);
+
+ std::vector<std::string> unconsumedArgs;
+ Arguments const arguments =
+ parser.Parse(cmMakeRange(args).advance(3), &unconsumedArgs);
+ if (!unconsumedArgs.empty()) {
+ status.SetError("COPY_FILE unknown argument:\n " +
+ unconsumedArgs.front());
+ return false;
+ }
+
+ bool result = true;
+ if (cmsys::SystemTools::FileIsDirectory(oldname)) {
+ if (!arguments.Result.empty()) {
+ status.GetMakefile().AddDefinition(arguments.Result,
+ "cannot copy a directory");
+ } else {
+ status.SetError(
+ cmStrCat("COPY_FILE cannot copy a directory\n ", oldname));
+ result = false;
+ }
+ return result;
+ }
+ if (cmsys::SystemTools::FileIsDirectory(newname)) {
+ if (!arguments.Result.empty()) {
+ status.GetMakefile().AddDefinition(arguments.Result,
+ "cannot copy to a directory");
+ } else {
+ status.SetError(
+ cmStrCat("COPY_FILE cannot copy to a directory\n ", newname));
+ result = false;
+ }
+ return result;
+ }
+
+ cmSystemTools::CopyWhen when;
+ if (arguments.OnlyIfDifferent) {
+ when = cmSystemTools::CopyWhen::OnlyIfDifferent;
+ } else {
+ when = cmSystemTools::CopyWhen::Always;
+ }
+
+ std::string err;
+ if (cmSystemTools::CopySingleFile(oldname, newname, when, &err) ==
+ cmSystemTools::CopyResult::Success) {
+ if (!arguments.Result.empty()) {
+ status.GetMakefile().AddDefinition(arguments.Result, "0");
+ }
+ } else {
+ if (!arguments.Result.empty()) {
+ status.GetMakefile().AddDefinition(arguments.Result, err);
+ } else {
+ status.SetError(cmStrCat("COPY_FILE failed to copy\n ", oldname,
+ "\nto\n ", newname, "\nbecause: ", err, "\n"));
+ result = false;
+ }
+ }
+
+ return result;
+}
+
+bool HandleRemoveImpl(std::vector<std::string> const& args, bool recurse,
+ cmExecutionStatus& status)
+{
for (std::string const& arg :
cmMakeRange(args).advance(1)) // Get rid of subcommand
{
@@ -1669,7 +1821,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
} else if (*i == "TLS_CAINFO") {
++i;
if (i != args.end()) {
- cainfo = &(*i);
+ cainfo = cmProp(*i);
} else {
status.SetError("DOWNLOAD missing file value for TLS_CAINFO.");
return false;
@@ -1795,9 +1947,7 @@ bool HandleDownloadCommand(std::vector<std::string> const& args,
}
}
-# if defined(_WIN32)
- url = fix_file_url_windows(url);
-# endif
+ url = cmCurlFixFileURL(url);
::CURL* curl;
::curl_global_init(CURL_GLOBAL_DEFAULT);
@@ -2055,7 +2205,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
} else if (*i == "TLS_CAINFO") {
++i;
if (i != args.end()) {
- cainfo = &(*i);
+ cainfo = cmProp(*i);
} else {
status.SetError("UPLOAD missing file value for TLS_CAINFO.");
return false;
@@ -2111,9 +2261,7 @@ bool HandleUploadCommand(std::vector<std::string> const& args,
unsigned long file_size = cmsys::SystemTools::FileLength(filename);
-# if defined(_WIN32)
- url = fix_file_url_windows(url);
-# endif
+ url = cmCurlFixFileURL(url);
::CURL* curl;
::curl_global_init(CURL_GLOBAL_DEFAULT);
@@ -2818,16 +2966,21 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args,
// Check if the command requires a symbolic link.
if (arguments.Symbolic) {
- completed = cmSystemTools::CreateSymlink(fileName, newFileName, &result);
+ completed = static_cast<bool>(
+ cmSystemTools::CreateSymlink(fileName, newFileName, &result));
} else {
- completed = cmSystemTools::CreateLink(fileName, newFileName, &result);
+ completed = static_cast<bool>(
+ cmSystemTools::CreateLink(fileName, newFileName, &result));
}
// Check if copy-on-error is enabled in the arguments.
if (!completed && arguments.CopyOnError) {
- completed = cmsys::SystemTools::CopyFileAlways(fileName, newFileName);
- if (!completed) {
- result = "Copy failed: " + cmSystemTools::GetLastSystemError();
+ cmsys::Status copied =
+ cmsys::SystemTools::CopyFileAlways(fileName, newFileName);
+ if (copied) {
+ completed = true;
+ } else {
+ result = "Copy failed: " + copied.GetString();
}
}
@@ -2850,11 +3003,10 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args,
bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- static const std::set<std::string> supportedPlatforms = { "Windows", "Linux",
- "Darwin" };
std::string platform =
status.GetMakefile().GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
- if (!supportedPlatforms.count(platform)) {
+ if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
+ platform)) {
status.SetError(
cmStrCat("GET_RUNTIME_DEPENDENCIES is not supported on system \"",
platform, "\""));
@@ -2882,6 +3034,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
std::string ResolvedDependenciesVar;
std::string UnresolvedDependenciesVar;
std::string ConflictingDependenciesPrefix;
+ std::string RPathPrefix;
std::string BundleExecutable;
std::vector<std::string> Executables;
std::vector<std::string> Libraries;
@@ -2891,6 +3044,9 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
std::vector<std::string> PreExcludeRegexes;
std::vector<std::string> PostIncludeRegexes;
std::vector<std::string> PostExcludeRegexes;
+ std::vector<std::string> PostIncludeFiles;
+ std::vector<std::string> PostExcludeFiles;
+ std::vector<std::string> PostExcludeFilesStrict;
};
static auto const parser =
@@ -2900,6 +3056,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
&Arguments::UnresolvedDependenciesVar)
.Bind("CONFLICTING_DEPENDENCIES_PREFIX"_s,
&Arguments::ConflictingDependenciesPrefix)
+ .Bind("RPATH_PREFIX"_s, &Arguments::RPathPrefix)
.Bind("BUNDLE_EXECUTABLE"_s, &Arguments::BundleExecutable)
.Bind("EXECUTABLES"_s, &Arguments::Executables)
.Bind("LIBRARIES"_s, &Arguments::Libraries)
@@ -2908,7 +3065,10 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
.Bind("PRE_INCLUDE_REGEXES"_s, &Arguments::PreIncludeRegexes)
.Bind("PRE_EXCLUDE_REGEXES"_s, &Arguments::PreExcludeRegexes)
.Bind("POST_INCLUDE_REGEXES"_s, &Arguments::PostIncludeRegexes)
- .Bind("POST_EXCLUDE_REGEXES"_s, &Arguments::PostExcludeRegexes);
+ .Bind("POST_EXCLUDE_REGEXES"_s, &Arguments::PostExcludeRegexes)
+ .Bind("POST_INCLUDE_FILES"_s, &Arguments::PostIncludeFiles)
+ .Bind("POST_EXCLUDE_FILES"_s, &Arguments::PostExcludeFiles)
+ .Bind("POST_EXCLUDE_FILES_STRICT"_s, &Arguments::PostExcludeFilesStrict);
std::vector<std::string> unrecognizedArguments;
std::vector<std::string> keywordsMissingValues;
@@ -2922,14 +3082,19 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
return false;
}
- const std::vector<std::string> LIST_ARGS = { "DIRECTORIES",
- "EXECUTABLES",
- "LIBRARIES",
- "MODULES",
- "POST_EXCLUDE_REGEXES",
- "POST_INCLUDE_REGEXES",
- "PRE_EXCLUDE_REGEXES",
- "PRE_INCLUDE_REGEXES" };
+ const std::vector<std::string> LIST_ARGS = {
+ "DIRECTORIES",
+ "EXECUTABLES",
+ "LIBRARIES",
+ "MODULES",
+ "POST_EXCLUDE_FILES",
+ "POST_EXCLUDE_FILES_STRICT",
+ "POST_EXCLUDE_REGEXES",
+ "POST_INCLUDE_FILES",
+ "POST_INCLUDE_REGEXES",
+ "PRE_EXCLUDE_REGEXES",
+ "PRE_INCLUDE_REGEXES",
+ };
auto kwbegin = keywordsMissingValues.cbegin();
auto kwend = cmRemoveMatching(keywordsMissingValues, LIST_ARGS);
if (kwend != kwbegin) {
@@ -2942,7 +3107,10 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
cmRuntimeDependencyArchive archive(
status, parsedArgs.Directories, parsedArgs.BundleExecutable,
parsedArgs.PreIncludeRegexes, parsedArgs.PreExcludeRegexes,
- parsedArgs.PostIncludeRegexes, parsedArgs.PostExcludeRegexes);
+ parsedArgs.PostIncludeRegexes, parsedArgs.PostExcludeRegexes,
+ std::move(parsedArgs.PostIncludeFiles),
+ std::move(parsedArgs.PostExcludeFiles),
+ std::move(parsedArgs.PostExcludeFilesStrict));
if (!archive.Prepare()) {
cmSystemTools::SetFatalErrorOccured();
return false;
@@ -2971,6 +3139,11 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
if (unique) {
deps.push_back(firstPath);
+ if (!parsedArgs.RPathPrefix.empty()) {
+ status.GetMakefile().AddDefinition(
+ parsedArgs.RPathPrefix + "_" + firstPath,
+ cmJoin(archive.GetRPaths().at(firstPath), ";"));
+ }
} else if (!parsedArgs.ConflictingDependenciesPrefix.empty()) {
conflictingDeps.push_back(val.first);
std::vector<std::string> paths;
@@ -3569,6 +3742,7 @@ bool cmFileCommand(std::vector<std::string> const& args,
{ "GLOB_RECURSE"_s, HandleGlobRecurseCommand },
{ "MAKE_DIRECTORY"_s, HandleMakeDirectoryCommand },
{ "RENAME"_s, HandleRename },
+ { "COPY_FILE"_s, HandleCopyFile },
{ "REMOVE"_s, HandleRemove },
{ "REMOVE_RECURSE"_s, HandleRemoveRecurse },
{ "COPY"_s, HandleCopyCommand },
@@ -3576,6 +3750,7 @@ bool cmFileCommand(std::vector<std::string> const& args,
{ "DIFFERENT"_s, HandleDifferentCommand },
{ "RPATH_CHANGE"_s, HandleRPathChangeCommand },
{ "CHRPATH"_s, HandleRPathChangeCommand },
+ { "RPATH_SET"_s, HandleRPathSetCommand },
{ "RPATH_CHECK"_s, HandleRPathCheckCommand },
{ "RPATH_REMOVE"_s, HandleRPathRemoveCommand },
{ "READ_ELF"_s, HandleReadElfCommand },