Update CMakeLists.txt
Also test for target.
Move cmake config files too on non-windows hosts.
Merge pull request #3216 from xantares:patch-1