title: linking a shared library with statics using CMake
body: <pre><code>cmake 2.8
  gcc (GCC) 4.8.1
  </code></pre>
  
  <p>Edit ----------</p>
  
  <p>Wrapping the static libraries in <code>whole-archive</code> works for every library except the <code>pjmedia-videodev</code> The problem now is that when I try and build I get the following error.</p>
  
  <pre><code>cbar_factory_init': colorbar_dev.c:(.text+0x2a0): undefined reference to pjmedia_format_init_video'
  </code></pre>
  
  <hr>
  
  <p>Hello,</p>
  
  <p>I have created a shared library and I need to link that library with about 10 static libraries. I then link my executable with the shared library.</p>
  
  <p>My question is that when I run make it fails to link as it wants the static libraries as well. The purpose of is to create a wrapper for the static libraries. So the executable only has to link with 1 single shared library. As I am linking the shared library with the statics, then the statics will automatically become part of the source code of the shared library.</p>
  
  <p>Only code sippnets to make it short.
  In my CMakeLists.txt that creates the shared library and links the static libraries:</p>
  
  <pre><code>add_library(app_module_sip SHARED app_module_sip_init.c)
  
   set(PJSIP_LIBRARIES
    g7221codec
    gsmcodec
    ilbccodec
    milenage
    pj
    pjlib-util
    pjmedia
    pjmedia-codec
    pjmedia-audiodev
    pjmedia-videodev
    pjnath
    pjsip
    pjsip-simple
    pjsip-ua
    pjsua
    portaudio
    resample
    speex
    srtp
  )
  
  target_link_libraries(app_module_sip pthread m uuid nsl rt asound crypto ssl ${PJSIP_LIBRARIES})
  </code></pre>
  
  <p>Now my CMakeLists.txt that makes the executable</p>
  
  <pre><code>add_executable(app sip_test.c)
  
  target_link_libraries(app app_module_sip)
  </code></pre>
  
  <p>Is this correct what I am doing here. I don't want to link the executable with the static libraries. Just the single shared library as that is my wrapper what I will be calling the functions in.</p>
  
  <p>It does link ok, if I link all the statics libraries when making the executable, but that is not the result I want.</p>
  
  <p>Many thanks for any suggestions,</p>