fix installation of main module headers

see: http://code.opencv.org/issues/2897

The order of the 2 conditions is really important, as every MATCHES
operator sets ${CMAKE_MATCH_1}, which is needed inside the condition
block. Ideally, this should be done using a single regex with a
negative forward lookahead, but CMake doesn't seem to support this
Fix CMake MSVC64 setting

Workaround for CMake bug (http://www.cmake.org/Bug/view.php?id=13896)
Merge branch 'fix-msvc64'
Merge remote-tracking branch 'origin/pr/797'