title: How to generate a DLL linked to a static library with CMake
body: <p>The main objective with this question is to write an <code>CMakeLists.txt</code> to generate a dynamic library, "containing/linked" a static library.</p>
  
  <p>Let me create the scenario:</p>
  
  <ul>
  <li>My C++ code is written in <code>mycode.cpp</code></li>
  <li>In <code>mycode.cpp</code>, I call some functions from <code>libthirdparty.a</code> (static library)</li>
  <li>I want to generate <code>libmylib.so</code> (shared library) to be dynamically linked by others</li>
  <li><code>libmylib.so</code> must to "contain" <code>libthirdparty.a</code> </li>
  </ul>
  
  <p>My attempt to write this script is at the lines bellow:</p>
  
  <pre><code>set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror -m64 -fPIC ")
  add_executable(myapp mycode.cpp)
  target_link_libraries(myapp thirdparty)
  add_library(mylib SHARED myapp)
  </code></pre>
  
  <p>But of course this is not working and I would like some help to write it correctly.</p>