cxxmodules: Do not scan sources while testing the compiler
The C++ sources we use to test the compiler do not use modules.
Avoid requiring a compiler that can scan just to enable the language,
even when CMP0155 is NEW. The project may explicitly turn off
CMAKE_CXX_SCAN_FOR_MODULES
before adding any targets.
Fixes: #25956 (closed)
Backport: release
Manual-backport: release-3.28