This check is actually pretty expensive. When cross-compiling it compiles and links, when not cross compiling it compiles, links and runs. By not caching this value we re-run the test every time cmake gets re-invoked.
In my local tests this change reduced iterative CMake executions from ~10.2 seconds to ~9.7 seconds.
Mind using ON here?