mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-01 04:08:46 -06:00
Merge topic 'file-archive-args'
7c83265e59file(ARCHIVE*): Simplify acceptance of empty list argumentsdfff470d15file(ARCHIVE*): Add test for keyword arguments with missing values Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7427
This commit is contained in:
@@ -3113,6 +3113,7 @@ bool HandleGetRuntimeDependenciesCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Arguments that are allowed to be empty lists. Keep entries sorted!
|
||||
const std::vector<std::string> LIST_ARGS = {
|
||||
"DIRECTORIES",
|
||||
"EXECUTABLES",
|
||||
@@ -3402,8 +3403,13 @@ bool HandleArchiveCreateCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Arguments that are allowed to be empty lists. Keep entries sorted!
|
||||
const std::vector<std::string> LIST_ARGS = {
|
||||
"OUTPUT", "FORMAT", "COMPRESSION", "COMPRESSION_LEVEL", "MTIME", "PATHS"
|
||||
"MTIME", // "MTIME" should not be in this list because it requires one
|
||||
// value, but it has long been accidentally accepted without
|
||||
// one and treated as if an empty value were given.
|
||||
// Fixing this would require a policy.
|
||||
"PATHS", // "PATHS" is here only so we can issue a custom error below.
|
||||
};
|
||||
auto kwbegin = keywordsMissingValues.cbegin();
|
||||
auto kwend = cmRemoveMatching(keywordsMissingValues, LIST_ARGS);
|
||||
@@ -3530,8 +3536,8 @@ bool HandleArchiveExtractCommand(std::vector<std::string> const& args,
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::vector<std::string> LIST_ARGS = { "INPUT", "DESTINATION",
|
||||
"PATTERNS" };
|
||||
// Arguments that are allowed to be empty lists. Keep entries sorted!
|
||||
const std::vector<std::string> LIST_ARGS = { "PATTERNS" };
|
||||
auto kwbegin = keywordsMissingValues.cbegin();
|
||||
auto kwend = cmRemoveMatching(keywordsMissingValues, LIST_ARGS);
|
||||
if (kwend != kwbegin) {
|
||||
|
||||
@@ -13,6 +13,9 @@ run_cmake(zip)
|
||||
# Extracting only selected files or directories
|
||||
run_cmake(zip-filtered)
|
||||
|
||||
run_cmake(create-missing-args)
|
||||
run_cmake(extract-missing-args)
|
||||
|
||||
run_cmake(unsupported-format)
|
||||
run_cmake(zip-with-bad-compression)
|
||||
run_cmake(7zip-with-bad-compression)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,9 @@
|
||||
^CMake Error at create-missing-args.cmake:[0-9]+ \(file\):
|
||||
file Keywords missing values:
|
||||
|
||||
OUTPUT
|
||||
FORMAT
|
||||
COMPRESSION
|
||||
COMPRESSION_LEVEL
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)$
|
||||
8
Tests/RunCMake/File_Archive/create-missing-args.cmake
Normal file
8
Tests/RunCMake/File_Archive/create-missing-args.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
file(ARCHIVE_CREATE
|
||||
OUTPUT # missing output path
|
||||
FORMAT # missing output format
|
||||
COMPRESSION # missing compression type
|
||||
COMPRESSION_LEVEL # missing compression level
|
||||
MTIME # missing modification time
|
||||
PATHS # no paths
|
||||
)
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,7 @@
|
||||
^CMake Error at extract-missing-args.cmake:[0-9]+ \(file\):
|
||||
file Keywords missing values:
|
||||
|
||||
INPUT
|
||||
DESTINATION
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)$
|
||||
5
Tests/RunCMake/File_Archive/extract-missing-args.cmake
Normal file
5
Tests/RunCMake/File_Archive/extract-missing-args.cmake
Normal file
@@ -0,0 +1,5 @@
|
||||
file(ARCHIVE_EXTRACT
|
||||
INPUT # missing input
|
||||
DESTINATION # missing destination
|
||||
PATTERNS # no patterns
|
||||
)
|
||||
Reference in New Issue
Block a user