Fix unnecessary rebuilds after cmake-configure.

Fixes unnecessary rebuilds after cmake-configure. Replacing file(WRITE ..)
by configure_file(..) which overcomes this issue.

Change-Id: I9853a210f9e6177d2c3dc512d403c57938f153ec
Merge topic 'fix_unnecessary_rebuilds' into next

108e890 Fix unnecessary rebuilds after cmake-configure.