Fixed CMake issue with FFMPEG videio configuration

This a forwardport of #3261 already applied to 2.4 branch.
This PR fixes issues with including FFMPEG source files in the videoio project file regardless of CMake WITH_FFMPEG option and including FFMPEG capture regardless of HAVE_FFMPEG flag.