title: cmake: target_link_libraries use static library not shared
body: <p>Is it possible to tell cmake to link against a <strong>static library</strong> instead of <strong>shared</strong>?</p>
  
  <p>At the top of my <code>CMakeLists.txt</code> I have the following configured:</p>
  
  <pre><code>set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
  </code></pre>
  
  <p>Later, I add a binary, and tell it to link against <code>tcmalloc</code> in release mode:</p>
  
  <pre><code>target_link_libraries(${BIN_NAME} optimized tcmalloc_minimal)
  </code></pre>
  
  <p>The resulting makefile links aginst the shared version of <code>tcmalloc</code>:</p>
  
  <pre><code>$ make VERBOSE=1 | grep tcmalloc
  /usr/bin/c++ ... -Wl,-Bdynamic ltcmalloc_minimal 
  </code></pre>
  
  <p>Further proof:</p>
  
  <pre><code>$ ldd app 
      ...
      libtcmalloc_minimal.so.4 =&gt; /usr/local/lib/libtcmalloc_minimal.so.4 (0x00007eff89733000)
      ...
  </code></pre>
  
  <p>Both static and shared versions of tcmalloc exist:</p>
  
  <pre><code>$ ls -1 /usr/local/lib/libtcmalloc_minimal*
  /usr/local/lib/libtcmalloc_minimal.a
  /usr/local/lib/libtcmalloc_minimal_debug.a
  /usr/local/lib/libtcmalloc_minimal_debug.la
  /usr/local/lib/libtcmalloc_minimal_debug.so
  /usr/local/lib/libtcmalloc_minimal_debug.so.4
  /usr/local/lib/libtcmalloc_minimal_debug.so.4.2.6
  /usr/local/lib/libtcmalloc_minimal.la
  /usr/local/lib/libtcmalloc_minimal.so
  /usr/local/lib/libtcmalloc_minimal.so.4
  /usr/local/lib/libtcmalloc_minimal.so.4.2.6
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>How can I configure cmake to link against the static version of <code>tcmalloc</code>?</p>