Cmake cross platform Execution Problems?

asked 2018-04-03 03:12:34 -0500

Chandra Sekar gravatar image

updated 2018-04-03 03:21:04 -0500

I've downloaded the opencv code from the github and executed the code using VisualStudio2012. There was no problem. I tested with some sample program execution, it works fine. With the same OpenCv code, i executed that in linux and also with some sample programs, it work's fine.

Now when i again build the same opencv code in the windows, the macros related to linux were checked on, windows related macros were checked out. Thus, resulting in the build failed.

I checked with the CMakeLists.txt, it shows UNIX, while executing in windows. How to get rid of this problem:?

Difference in CMakeFiles.txt when in windows, thus linux macros are checked in

edit retag flag offensive close merge delete


your screenshot is somewhat useless here (as ppl can't quote you, it cannoot be searched, etc. try to come up with a text representation..

(and it also only shows that the text encoding (line endings and such) differs between the github and the SF version. nothing to worry about , here)

"the macros related to linux were checked on, windows related macros were checked out." -- that's not, what it shows above.

"Thus, resulting in the build failed. " -- you will need to explain better, what you did exactly, and what the resulting error msgs were.

berak gravatar imageberak ( 2018-04-03 03:26:57 -0500 )edit

i made certain changes in the opencv code and compiled in the linux, it works fine. When Cmake'ing the same code in windows and build using visual studio, the build failed, because of the linux macros were checked in, when running in windows. How to disable linux macros in windows?

Chandra Sekar gravatar imageChandra Sekar ( 2018-04-03 03:45:25 -0500 )edit

which macros are you talking about ?

what did you change ?

berak gravatar imageberak ( 2018-04-03 03:48:38 -0500 )edit

Check here the macros will be defined as #ifdef CAP_VFW or CAP_V4L , etc.

Here, check with the cvCreateCameraCapture function(), TRY_OPEN(),.

In Windows, 
#ifdef HAVE_VFW
        TRY_OPEN(capture, cvCreateCameraCapture_VFW(index))
(This to be checked in), but for me,

#if defined HAVE_LIBV4L || defined HAVE_CAMV4L || defined HAVE_CAMV4L2 || defined HAVE_VIDEOIO
        TRY_OPEN(capture, cvCreateCameraCapture_V4L(index))

(This is check in)

Chandra Sekar gravatar imageChandra Sekar ( 2018-04-03 04:54:31 -0500 )edit