Querying LOCATION source file property confuses CMake about later LOCATION queries
Demonstrating the issue (given test.c file does NOT exist on disk):
cmake_minimum_required(VERSION 3.25)
project(test LANGUAGES C)
include(CMakePrintHelpers)
# cmake_print_properties(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/test.c PROPERTIES LOCATION) # uncommenting this line changes the result below!
add_custom_command(OUTPUT test.c COMMAND bla)
cmake_print_properties(SOURCES test.c PROPERTIES LOCATION)
Running the above prints the BUILD directory LOCATION of test.c (by the second print statement).
Uncommenting the first cmake_print_properties() line above causes the second cmake_print_properties() call to print <NOTFOUND>.
Meaning simply querying the LOCATION property changes behaviour!
This might be related to #24311