To build a project, even small one, you need a build system.
VS Projects, or MSBuild, is one of many existing build systems, and not the best one.
CMake allows you to create a build system settings for compilers and tools, existing on your computer.
You have VS installed, but someone doesn't, but instead of VS, he has QT Creator, or Eclipse, or Netbeans. Visual studio implies using Microsoft's or Intel's compilers, which generally cost a lot.
What about free MinGW GCC? Visual Studio doesn't work with it.
Moreover, Visual Studio is limited to Windows only, and that Windows should better not run on virtual machine.
What about Linux, MacOS, other unixes? Android?
All of them don't have the Visual Studio and hardly ever will.
CMake allows all of them build OpenCV also.
And even with the single Visual Studio, the build can be customized, since OpenCV may or may not use some external libraries (Eigen, QT, and some others), depending on user needs. Someone would need them, and someone not. Installation directories differ also. Therefore, we would need to customize what to build, what to link, and where those libraries are.
Such customization would be hard, if even possible, in case of project files manually created with Visual Studio wizards.
and at http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html there is a sample like this
include <cv.h>
include <highgui.h>
using namespace cv;
int main( int argc, char** argv ) { Mat image; image = imread( argv[1], 1 );
if( argc != 2 || !image.data ) { printf( "No image data \n" ); return -1; } namedWindow( "Display Image", CV_WINDOW_AUTOSIZE ); imshow( "Display Image", image );
waitKey(0);
return 0; } Why don't we use vc studio build and make excutable file directly? can we?
Please reformat and rephrase both your question and self-answer. It is horrible to read.