This can be recreated on at least macOS, due to #32707.
If there are two checkouts of the source, the build in one directory, can fail to configure, because of files in the other directory:
0git clone https://github.com/bitcoin/bitcoin/ bitcoin_a
1git clone https://github.com/bitcoin/bitcoin/ bitcoin_b
2
3cd bitcoin_a
4make -C depends HOST=x86_64-w64-mingw32
5# fails to build libevent (#32707)
6cd ../bitcoin_b
7# fails to configure, because of the libevent config files (for a different target) in the other checkout
8cmake -B build
9<snip>
10-- Performing Test NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE
11-- Performing Test NO_DIAGNOSTICS_BOOST_NO_CXX98_FUNCTION_BASE - Failed
12CMake Error at /Users/xxx/bitcoin_a/depends/work/build/x86_64-w64-mingw32/libevent/2.1.12-stable-f0fd46dc234/build/LibeventConfig.cmake:75 (message):
13 Your libevent library does not contain a pthreads component!
14
15 The valid components are core, extra, pthreads and openssl.
16Call Stack (most recent call first):
17 /Users/xxx/bitcoin_a/depends/work/build/x86_64-w64-mingw32/libevent/2.1.12-stable-f0fd46dc234/build/LibeventConfig.cmake:90 (no_component_msg)
18 cmake/module/FindLibevent.cmake:54 (find_package)
19 CMakeLists.txt:416 (find_package)