title: cmake add external library
body: <p>I would like to add a dependency to a target. This dependency is a precompiled lib. I would like to be able to get a external dependency just by specifing a name like <code>add_dep(libName)</code> in my <code>CMakeLists.txt</code>. The <code>add_dep</code> function should be reusable for different libraries.</p>
  
  <p>I couldn't find any way to do this, <a href="https://rix0r.nl/blog/2015/08/13/cmake-guide/" rel="nofollow noreferrer">only for libs which are compiled during build</a></p>
  
  <p><a href="https://community.kde.org/Frameworks/Epics/CMake_target_usage_requirements" rel="nofollow noreferrer">how would I pass the target name in a generic form here?</a></p>
  
  <p><a href="https://ecrafter.wordpress.com/2012/06/16/cmake-tutorial-part-5/" rel="nofollow noreferrer">would be fine, but the "consumer" shouldn't have to add inc/lib dirs etc</a>.</p>