title: linking opencv libraries included as an external project via cmake
body: <p>I'm relatively new to cmake and after days of struggling couldn't figure out the following thing:</p>
  
  <p>I have a project that depends on opencv (which is a cmake project on its own) and I want to statically link opencv libraries. What I'm doing is I have a copy of opencv source code in my project and include it into my CMakeLists.txt via</p>
  
  <pre><code>ExternalProject_Add(my_copy_of_opencv_project
     CMAKE_ARGS -D BUILD_SHARED_LIBS=NO ...
     CMAKE_INSTALL_PREFIX=${MY_OPENCV_INSTALL_DIR} 
     SOURCE_DIR ${PATH_TO_OPENCV_SRCS} 
  )
  </code></pre>
  
  <p>All built nicely and where I have problem is that I cannot reliably determine where the opencv libraries will be. E.g. on linux/mac there are in <code>${MY_OPENCV_INSTALL_DIR}/lib</code> and are named as <code>libopencv_core.a</code> whereas on 32-bit Windows with VS 2012 installed the libs are in <code>${MY_OPENCV_INSTALL_DIR}/lib/x86/vc11/staticlib</code> and for the Debug configuration the libs named like <code>opencv_core247d.lib</code>. </p>
  
  <p>So the question is can I somehow obtain a list of all libraries produced by the OpenCV build (and the root lib folder) and link them via something like <code>target_link_libraries(mylib opencv_core ...)</code>? </p>
  
  <p>Maybe I'm doing something wrong or overcomplicated. So what I basically want is to compile my embedded opencv source tree statically and link against its libraries in a "cross-plaformish" way.</p>
  
  <p>Any pointers are highly appreciated! Thanks!</p>