Ask Your Question
0

Why shall we install CMake for building Lib?

asked 2012-11-23 05:39:16 -0600

learner gravatar image

updated 2012-11-27 10:29:35 -0600

AlexanderShishkov gravatar image

Title Building the lib at http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html#windows-installation show us at second article that install CMake after we have IDE(VS studio) already had in our computer. I wonder shall I use vc studio build opencv lib instead of software cmake? What different is vc studio builder inside from cmake?

edit retag flag offensive close merge delete

Comments

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?

learner gravatar imagelearner ( 2012-11-23 05:49:10 -0600 )edit

Please reformat and rephrase both your question and self-answer. It is horrible to read.

SR gravatar imageSR ( 2012-11-27 09:00:33 -0600 )edit

2 answers

Sort by » oldest newest most voted
3

answered 2012-11-28 02:27:02 -0600

wl2776 gravatar image

updated 2012-11-28 02:54:24 -0600

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.

edit flag offensive delete link more

Comments

thank you very much

learner gravatar imagelearner ( 2015-09-02 07:23:16 -0600 )edit
-2

answered 2012-11-27 07:14:00 -0600

learner gravatar image

■CMake is a neat tool to make the project files (for your choosen IDE) from the OpenCV source files

and IDE can also make project files, can't it? what different is this cmake from IDE?

edit flag offensive delete link more

Comments

Not "from OpenCV source files", but from files, named CMakeLists.txt and *.cmake, which were created especially for this purpose.

wl2776 gravatar imagewl2776 ( 2012-11-28 07:45:41 -0600 )edit

Question Tools

Stats

Asked: 2012-11-23 05:39:16 -0600

Seen: 604 times

Last updated: Nov 28 '12