title: CMake generate shared library with Opencv
body: <p>I am new to CMake. I want to compile a shared lib of my code with OpenCV lib. Here is my CMakeLists file</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.7)
  project(FM)
  
  set(CMAKE_CXX_STANDARD 14)
  
  find_package(OpenCV REQUIRED)
  
  set(HEADER_FILES
          FeatureExtract2.h
          FeatureCompare2.h
          Matching.h
          Helper.h
          )
  
  set(SOURCE_FILES
          FeatureExtract2.cpp
          FeatureCompare2.cpp
          Matching.cpp
          )
  
  add_library(FM SHARED ${HEADER_FILES} ${SOURCE_FILES})
  target_link_libraries(FM OpenCV_LIBS})
  </code></pre>
  
  <p>And this is CMake error:
  <code>
  (target_link_libraries):
    Cannot specify link libraries for target "FM" which is not built by this project.
  </code>
  What am I doing wrong here? Much appreciated!</p>