title: Error compiling an OpenCV project with CMake
body: <p>I followed <a href="https://www.youtube.com/watch?v=RS_uQGOQIdg&amp;feature=iv&amp;src_vid=bSeFrPrqZ2A&amp;annotation_id=annotation_3340124015" rel="nofollow">this tutorial</a> trying to create some OpenCV project.
  It worked great in Windows and Visual Studio but then I tried to run it in my Ubunto VM using CMake by using the following CmakeLists.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  project( TrackObj )
  find_package( OpenCV REQUIRED )
  add_executable( TrackObj Source.cpp Fruit.cpp Fruit.h)
  target_link_libraries( TrackObj ${OpenCV_LIBS} )
  </code></pre>
  
  <p>When I run <code>cmake .</code> it seems like everything is fine: </p>
  
  <pre><code>vm@vm-ubuntu:~/Desktop/TrackObj$ cmake .
  -- The C compiler identification is GNU 4.8.2
  -- The CXX compiler identification is GNU 4.8.2
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/vm/Desktop/TrackObj
  </code></pre>
  
  <p>but when I run <code>make</code> I get the following errors:</p>
  
  <pre><code>vm@vm-ubuntu:~/Desktop/TrackObj$ make
  Scanning dependencies of target TrackObj
  [ 50%] Building CXX object CMakeFiles/TrackObj.dir/Source.cpp.o
  In file included from /usr/include/c++/4.8/thread:35:0,
                   from /home/vm/Desktop/TrackObj/Source.cpp:10:
  /usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   #error This file requires compiler and library support for the \
    ^
  make[2]: *** [CMakeFiles/TrackObj.dir/Source.cpp.o] Error 1
  make[1]: *** [CMakeFiles/TrackObj.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>
  
  <p>I'm very new to CMake but I'm pretty sure the problem is something with the fact I'm using multiple .cpp files and the way I'm using CMake. The reason is that <strong>when I tried to run a <a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A" rel="nofollow">previews step in the tutorial</a>, when the project includes only one .cpp file, it all works great.</strong></p>
  
  <p>You can see the source code that <strong>did work</strong> <a href="https://raw.githubusercontent.com/kylehounslow/opencv-tuts/master/object-tracking-tut/objectTrackingTut.cpp" rel="nofollow">here</a> (with minor changes like removing <code>#include &lt;opencv\highgui.h&gt; #include &lt;opencv\cv.h&gt;</code> and writing instead: <code>#include &lt;opencv2/opencv.hpp&gt;</code>.
  And the source code that <strong>did not work</strong> <a href="https://raw.githubusercontent.com/kylehounslow/opencv-tuts/master/multiple-object-tracking-tut/part-two/multipleObjectTracking.cpp" rel="nofollow">here</a> with the same minor changes. In addition, the project includes the very simple Fruit.cpp and Fruit.h as described in the video.</p>
  
  <p>I went over the not so friendly <a href="http://www.cmake.org/cmake-tutorial/" rel="nofollow">official tutorial</a> of CMake and the more friendly <a href="https://www.johnlamp.net/cmake-tutorial-1-getting-started.html" rel="nofollow">johnlamp</a> and <a href="http://docs.opencv.org/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html" rel="nofollow">OpenCV</a> tutorials but could not find what I'm doing wrong here.</p>