Incorrect file/line reference with --trace and else() statement
The file/line reference written to the --trace output seems to be incorrect sometimes. I see this with the following else() statement, and these two files:
# file: aaa.cmake
include(bbb.cmake)
my_macro(FALSE)
and
# file: bbb.cmake
macro(my_macro arg)
if (arg)
message(STATUS "TRUE branch")
else()
message(STATUS "FALSE branch")
endif()
endmacro()
When I run CMake I get:
$ cmake --trace -P aaa.cmake
Running with trace output on.
/tmp/trace-expand-bug/aaa.cmake(2): include(bbb.cmake )
/tmp/trace-expand-bug/bbb.cmake(2): macro(my_macro arg )
/tmp/trace-expand-bug/aaa.cmake(3): my_macro(FALSE )
/tmp/trace-expand-bug/bbb.cmake(3): if(arg )
/tmp/trace-expand-bug/aaa.cmake(5): else()
/tmp/trace-expand-bug/bbb.cmake(6): message(STATUS FALSE branch )
-- FALSE branch
The file reference for "else()" is the file "aaa.cmake", but it is located in "bbb.cmake" (where line number 5 would make sense).
I tried this with CMake 3.21.1.