Rework cmake build system
In order to support the build of x265 source folder scheme, a few patches were necessary. Indeed x265 is having a different source folder from where CMakeList.txt can be found.
- Change cmake template which was used incorrectly for -H -B
- Change to apply patches, get license in the source folder and not in the build folder.
- various fixes