try_compile: Add options/policy to specify/honor language standards
Projects use try_compile
to check if they will be able to compile some particular source code. When a language standard variable like CMAKE_CXX_STANDARD
is set, then the project intends to compile source code using a compiler mode for that standard. Therefore it makes sense for try_compile
to use that standard in the test project too. Add a policy to introduce the improved behavior in a compatible way. Also add explicit options to request different standards for specific call sites.
Closes: #16456 (closed)