mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-25 07:38:33 -05:00
fd46db1745
There have been two bugs reported about the `else` and `elseif` commands in the context of the tracing functionality and the json-v1 format (#23191 #22315). In essence, the reported traces referred to the layer of the stacktrace immediately on top of the expected ones. This MR fixes both issues. My solution adds a new parameter to the `PrintCommandTrace` function, `commandMissingFromStack`, that callers can specify if the command they want to report a trace for is not a regular part of the stack maintained in `cmMakefile`. This is only the case for `else` and `elseif`. The other bug is fixed by having the caller pass a `cmListFileBacktrace`, which helps in getting the right lines, file names... for the reported command. Fixes: #23191 #22315
15 lines
193 B
CMake
15 lines
193 B
CMake
function(function_that_uses_else)
|
|
if(FALSE)
|
|
else()
|
|
endif()
|
|
endfunction()
|
|
function(f)
|
|
message(STATUS "nested global_frame")
|
|
endfunction()
|
|
|
|
function(g)
|
|
f()
|
|
endfunction()
|
|
|
|
g()
|