Factored out the sequence into one cmake-script. Previously it could happen that the python script failed, but the following command was successfull and so the error was hidden.