title: Create a static library that refers to other static libraries
body: <p>I would like to create a static library that depends on another library, in this case ZLIB, for which I already have a static build (libz.a).</p>
  
  <p>I have the following:</p>
  
  <pre><code>...
  set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
  set (BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
  set (CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # to find the .a   instead of the .so
  ...
  find_package(ZLIB REQUIRED)
  if (ZLIB_FOUND)
    message(STATUS "ZLIB library: ${ZLIB_LIBRARIES}") # ZLIB library:     /usr/lib64/libz.a
    include_directories(${ZLIB_INCLUDE_DIRS})
    set (EXT_LIBS ${EXT_LIBS} ${ZLIB_LIBRARIES})
  endif()
  ...
  add_library (libTest ${MCCORE_SOURCES_CC})
  target_link_libraries(libTest ${EXT_LIBS}) #EXT_LIBS = /usr/lib64/libz.a
  </code></pre>
  
  <p>However, the final step of the build is creating the static library but without any reference to <code>/usr/lib64/libz.a</code></p>
  
  <p>ex:</p>
  
  <pre><code>/usr/bin/ar cr libTest.a  object1.o object2.o ... objectN.o 
  </code></pre>
  
  <p>I would expect:</p>
  
  <pre><code>/usr/bin/ar cr libTest.a  object1.o object2.o ... objectN.o /usr/lib64/libz.a
  </code></pre>
  
  <p>It seems the final archive creation doesn't care for libraries set with <code>target_link_libraries</code>. </p>
  
  <p>Any ideas?</p>
  
  <p>What can I do to force this?</p>