CMake language standard for check* functions
A key feature of meta-build systems is dynamically testing system capabilities. Dynamic checks are easier to maintain and use versus large if-else trees or requiring the user to manually include specific Makefiles, etc. In CMake, dynamic testing via check* module functions generally wrap try_compile with logic to only run the check once. try_compile() will run each time CMake runs unless additional if() guard logic is put around try_compile().
check_source_compiles
shows the influence six variables CMAKE_REQUIRED*
have on the check*
functions.
Rather than manually setting CMAKE_REQUIRED_FLAGS
with compiler language standard flags, instead we recommend setting
CMAKE_CXX_STANDARD
or similar variable for the code language being checked.
The CMAKE_CXX_STANDARD
(or similar for C etc.) takes effect in the check* functions.