title: OpenCV CLion (Cmake) linking issue - cmake reports a strange error
body: <p>I can't get my CLion to build the project because of a weird error upon saving my CMakeLists and/or building the project:<code>
  Error:Found package configuration file:
    /usr/share/opencv/OpenCVConfig.cmake
  but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be NOT FOUND.</code></p>
  
  <p><strong>Source file</strong>:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  
  using namespace cv;
  
  int main(int argc, char** argv )
  {
      Mat image;
      image = imread( "lena.jpg", 1 );
      if ( !image.data )
      {
          printf("No image data \n");
          return -1;
      }
      namedWindow("Display Image", WINDOW_AUTOSIZE );
      imshow("Display Image", image);
      waitKey(0);
      return 0;
  }
  </code></pre>
  
  <p>My <strong>CMakeLists.txt</strong>:<code>
  cmake_minimum_required(VERSION 3.3)
  project(Test)
  find_package( OpenCV REQUIRED )
  add_executable( Test main.cpp )
  target_link_libraries( Test ${OpenCV_LIBS} )</code></p>
  
  <p>$ pkg-config --cflags opencv<code>
  -I/usr/include/opencv</code></p>
  
  <p>$ pkg-config --libs opencv<code>
  -L/lib64 -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -ltbb -lGL -lGLU -lrt -lpthread -lm -ldl</code> </p>
  
  <p>The fact is when I <strong>manually</strong> <code>cmake . &amp; make</code> (with all the same CMakeLists file) my project from console it works just fine with <strong>no errors</strong>.</p>
  
  <p>OpenCV version: 2.4.11-1 (arch linux)
  CLion: latest.</p>
  
  <p>OpenCVConfig.cmake difference compared to git version: https:// www.diffchecker. com/vtmmiu1w</p>
  
  <p>Manual build output: </p>
  
  <pre><code>[dobegor@dobegor-pc Test]$ cmake .
  -- The C compiler identification is GNU 5.2.0
  -- The CXX compiler identification is GNU 5.2.0
  -- 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
  -- Detecting C compile features
  -- Detecting C compile features - 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
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/dobegor/ClionProjects/Test
  [dobegor@dobegor-pc Test]$ make 
  Scanning dependencies of target Test
  [ 50%] Building CXX object CMakeFiles/Test.dir/main.cpp.o
  [100%] Linking CXX executable Test
  [100%] Built target Test
  </code></pre>