BUG #14031: Avoid repeated try_compiles().

Avoid repeated try_compiles() on each cmake-configure to minimize
build/configure times.

Change-Id: Id23f2a11fa516bb4040f5cba0c7667795ae7c815
Merge topic 'fix_protobuf_try_compiles' into next

dfd2278 BUG #14031: Avoid repeated try_compiles().