diff options
author | Brad King <brad.king@kitware.com> | 2022-01-12 14:45:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-01-12 14:45:06 (GMT) |
commit | eb4e99563c7247404872c4b3064b6061a05dd5f2 (patch) | |
tree | c14ba5cd347ed0765c8ba1aa8fa1168eee77c3cd | |
parent | 4b8126fa409e8558f465c70eaa794dab82819d8d (diff) | |
parent | 41bebbe50a66dfe7bb32365bd119e7e679d0faf1 (diff) | |
download | CMake-eb4e99563c7247404872c4b3064b6061a05dd5f2.zip CMake-eb4e99563c7247404872c4b3064b6061a05dd5f2.tar.gz CMake-eb4e99563c7247404872c4b3064b6061a05dd5f2.tar.bz2 |
Merge topic 'file-READ_ELF-capture-error' into release-3.22
41bebbe50a file: Restore error capture in undocumented READ_ELF mode
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6853
-rw-r--r-- | Source/cmFileCommand.cxx | 11 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_ELF-stderr.txt | 21 | ||||
-rw-r--r-- | Tests/RunCMake/file/READ_ELF.cmake | 2 |
3 files changed, 29 insertions, 5 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index fd0595d..c3ae228 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -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()) { diff --git a/Tests/RunCMake/file/READ_ELF-stderr.txt b/Tests/RunCMake/file/READ_ELF-stderr.txt index 7b32804..fd02ca1 100644 --- a/Tests/RunCMake/file/READ_ELF-stderr.txt +++ b/Tests/RunCMake/file/READ_ELF-stderr.txt @@ -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\)$ diff --git a/Tests/RunCMake/file/READ_ELF.cmake b/Tests/RunCMake/file/READ_ELF.cmake index cd02c9b..8778fc2 100644 --- a/Tests/RunCMake/file/READ_ELF.cmake +++ b/Tests/RunCMake/file/READ_ELF.cmake @@ -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) |