title: CMake shared (or static?) library fails to link
body: <p>I am currently trying to compile a project using some shared and static pre-compiled libraries on an ARM platform using CMake.  Here's an overview of the project structure.</p>
  
  <pre><code>&lt;main project directory&gt;
    |-- CMakeLists.txt
    |-- face_detect.cpp
    |-- face_detect.hpp
    |-- video_test.cpp
    |-- build
    |     |-- &lt;various CMake build files&gt;
  </code></pre>
  
  <p>Here's the directory structure where the libraries I'm trying to link are.</p>
  
  <pre><code>&lt;/usr/share/ti&gt;
    |-- opencl
    |   |-- &lt;various header files for TI OpenCL including dsp.h&gt;
    |   |-- dsp.out
    |   |-- dsp.syms
    |   |-- dsp_syms.obj
    |-- tidl
    |   |-- tidl_api
    |   |     |-- inc
    |   |     |     |-- congfiguration.h
    |   |     |     |-- execution_object.h
    |   |     |     |-- execution_object_internal.h
    |   |     |     |-- execution_object_pipeline.h
    |   |     |     |-- executor.h
    |   |     |     |-- imgutil.h
    |   |     |-- tidl_api.a
    |   |     |-- tidl_imgutil.a
    |   |     |-- tidl.so
  </code></pre>
  
  <p>Now here's an explanation:  </p>
  
  <p>I am using OpenCV with the dnn module right now to do facial detection (and eventually recognition) on a BeagleBoard AI (TI Sitara processor).  The code compiles and runs just fine without the TI Deep Learning API (TIDL), but for some reason when I try to <code>make</code> the project it throws the following error (builds fine, fails in linking stage):  </p>
  
  <pre><code>face_detect.cpp:(.text+0x16): undefined reference to `tidl::Executor::GetNumDevices(tidl::DeviceType)'
  collect2: error: ld returned 1 exit status
  CMakeFiles/face_detect.dir/build.make:142: recipe for target 'face_detect' failed
  make[2]: *** [face_detect] Error 1
  CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/face_detect.dir/all' failed
  make[1]: *** [CMakeFiles/face_detect.dir/all] Error 2
  Makefile:83: recipe for target 'all' failed
  make: *** [all] Error 2 
  </code></pre>
  
  <p><code>nm tidl_api.a | grep GetNumDevices</code> shows that the symbols are indeed in the library, so I think it must be a problem with CMake. In addition, the examples shipped with the board leveraging the TIDL API work, so I know the API works fine.</p>
  
  <p>What could be causing the linker failure? I will put my CMakeLists.txt file below. I've got some unnecessary lines in there from trying stuff to make it work. Thanks for looking!</p>
  
  <pre><code>project( hello_face )
  
  cmake_minimum_required( VERSION 3.7 )
  
  set( CMAKE_CXX_STANDARD 14 )
  set( CMAKE_CXX_STANDARD_REQUIRED True )
  set( OpenCV_DIR /opt/opencv-4.2.0/lib/cmake/opencv4 )
  
  find_package( OpenCV REQUIRED )
  
  include_directories( "/usr/share/ti/tidl/tidl_api/inc" )
  include_directories( "/usr/share/ti/tidl/tidl_api" )
  include_directories( "/usr/share/ti/opencl" )
  link_directories( "/usr/share/ti/tidl/tidl_api" )
  link_directories( "/usr/share/ti/tidl/tidl_api/inc" )
  link_directories( "/usr/share/ti/opencl" )
  
  add_library( tidl SHARED IMPORTED )
  set_property( TARGET tidl PROPERTY IMPORTED_LOCATION "/usr/share/ti/tidl/tidl_api/tidl.so" )
  
  add_library( tidl_api STATIC IMPORTED )
  set_property( TARGET tidl_api PROPERTY IMPORTED_LOCATION "/usr/share/ti/tidl/tidl_api/tidl_api.a" )
  
  add_library( tidl_imgutil STATIC IMPORTED )
  set_property( TARGET tidl_imgutil PROPERTY IMPORTED_LOCATION "/usr/share/ti/tidl/tidl_api/tidl_imgutil.a" )
  
  add_executable( video_test video_test.cpp )
  target_link_libraries( video_test ${OpenCV_LIBS} )
  
  add_executable( face_detect face_detect.cpp )
  target_link_libraries( face_detect ${OpenCV_LIBS} ${tidl_LIBS} ${tidl_api_LIBS} ${tidl_imgutil_LIBS} )
  </code></pre>
  
  <p>EDIT: As per squareskittles' suggestion, I changed the final line of CMakeLists.txt to <code>target_link_libraries( face_detect PUBLIC ${OpenCV_LIBS} tidl tidl_api tidl_imgutil )</code>. I now get a long list of undefined references to Python methods/objects such as 'PyFloat_Type' and 'PyList_New' inside <code>tidl.so</code>.  Not sure why it's depending on Python types for a pure c++ project. </p>