try_compile: Honor CMAKE_WARN_DEPRECATED in test project
This causes the -Wno-deprecated
option to be honored even inside a try_compile
test project, which is needed to suppress all deprecation warnings as the option documents.
Closes: #16446 (closed)