I haven't tested building on Tahoe yet, but the error should be easy to fix by manually setting the library path.
Something like this:
export LIBRARY_PATH="/System/Library/Frameworks/AGL.framework"Delete CMakeCache.txt and the run cmake command again.