title: CMake doesn't find self compiled library
body: <p><strong>Background:</strong></p>
  
  <p><strong>I'm compiling a shared C library in a separate project and need to link against it with CMake.</strong></p>
  
  <p>I've used a C based neural network implementation called <a href="https://pjreddie.com/darknet/yolo/" rel="nofollow noreferrer">darknet</a> to train a custom object detector.</p>
  
  <p>Actually darknet is a standalone C executable. But I need to integrate the detector into a larger C++ codebase.
  I already found a small <a href="https://github.com/TommyX12/darknet-cpp-wrapper" rel="nofollow noreferrer">wrapper</a>.
  Now I would like to convert the wrapper code into a CMake project, compile darknet into a shared library and link against it.</p>
  
  <ul>
  <li>I've compiled this to a shared library with the compiler flags <code>-fPIC</code> and <code>-shared</code>.</li>
  <li>The output was called <code>darknet</code>, I renamed it to <code>darknet.so</code> and copied it to <code>/usr/lib/</code></li>
  <li><code>sudo ldconfig</code></li>
  </ul>
  
  <p><strong>Question:</strong></p>
  
  <p>This is my <code>CMakeLists.txt</code>. As you can see, I'm linking against the darknet library. At compile time, there is an error, the library isn't found.</p>
  
  <pre><code>CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
  project(wrapper)
  
  add_definitions(-std=c++14)
  
  find_package(OpenCV 3.2.0 EXACT REQUIRED)
  
  include_directories(
          ${OpenCV_INCLUDE_DIRS}
          example
          wrapper
          darknet_src
  )
  
  SET(SOURCES
          example/main.cpp
  
          wrapper/darknet.cpp
          wrapper/darknet.h
          wrapper/darknet_detector.c
          wrapper/darknet_detector.h)
  
  add_executable(wrapper ${SOURCES})
  target_link_libraries(wrapper darknet ${OpenCV_LIBS})
  </code></pre>