cmake: implement error handling in configure_file

Implement error handling in case it fails

Fixes: #20696
1 file changed