The build time error is confusing for users. The patch makes the error explicit and moves it to the cmake stage. Follow up of #3070.