mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 07:28:51 -06:00
file: Restore error capture in undocumented READ_ELF mode
Revise the error message added by commit 115ff6a347 (cmELF: Include the
ELF parsing code unconditionally, 2021-06-17, v3.22.0-rc1~557^2) to
honor the `CAPTURE_ERROR` option. This is needed by the call site in
`BundleUtilities` to suppress errors on non-ELF files.
Fixes: #23074
This commit is contained in:
@@ -1213,9 +1213,14 @@ bool HandleReadElfCommand(std::vector<std::string> const& args,
|
||||
|
||||
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.Error.empty()) {
|
||||
status.SetError(cmStrCat("READ_ELF given FILE:\n ", fileNameArg,
|
||||
"\nthat is not a valid ELF file."));
|
||||
return false;
|
||||
}
|
||||
status.GetMakefile().AddDefinition(arguments.Error,
|
||||
"not a valid ELF file");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!arguments.RPath.empty()) {
|
||||
|
||||
@@ -1,2 +1,19 @@
|
||||
.*file READ_ELF must be called with at least three additional arguments\.
|
||||
.*file READ_ELF given FILE "XXX" that does not exist\.
|
||||
^CMake Error at READ_ELF.cmake:1 \(file\):
|
||||
file READ_ELF must be called with at least three additional arguments\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at READ_ELF.cmake:2 \(file\):
|
||||
file READ_ELF given FILE "XXX" that does not exist\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)
|
||||
+
|
||||
CMake Error at READ_ELF.cmake:4 \(file\):
|
||||
file READ_ELF given FILE:
|
||||
|
||||
[^
|
||||
]*/Tests/RunCMake/file/READ_ELF.cmake
|
||||
|
||||
that is not a valid ELF file\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:[0-9]+ \(include\)$
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
file(READ_ELF XXX)
|
||||
file(READ_ELF XXX RPATH YYY)
|
||||
file(READ_ELF ${CMAKE_CURRENT_LIST_FILE} RPATH YYY CAPTURE_ERROR err)
|
||||
file(READ_ELF ${CMAKE_CURRENT_LIST_FILE} RPATH YYY)
|
||||
|
||||
Reference in New Issue
Block a user