title: Linker errors on library built using CMake
body: <p>I am pretty new to CMake and tried to write a simple static library that does some image manipulation using Qt4.</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  project(timage)
  
  find_package(Qt4 REQUIRED)
  include(${QT_USE_FILE})
  add_definitions(${QT_DEFINITIONS})
  
  include_directories(
      "${PROJECT_SOURCE_DIR}/include"
  )
  add_library(
      timage
      ${PROJECT_SOURCE_DIR}/source/timage.cpp
  )
  target_link_libraries(
      timage
      ${QT_LIBRARIES}
  )
  </code></pre>
  
  <p>I can configure, and generate it, and it even successfully builds <code>libtimage.a</code>. Now I want to include it into my main project, and here is where the trouble begins.</p>
  
  <p>I started off with some unit tests, but already I get linker errors (<code>undefined reference</code> for every single function call of the <code>TImage</code> class). I built my unit tests with <code>g++ -Wall -Wextra -std=c++11 -I../include -L../bin -ltimage -o test spec.cpp</code></p>
  
  <p>I personally do not see the difference between what I am doing to the <a href="http://www.cmake.org/cmake/help/cmake_tutorial.html" rel="nofollow">beginner's tutorial</a> besides the Qt4 work. I would appreciate if someone could give me a hint in the right direction here.</p>
  
  <p><strong>Update</strong>
  I just found out that if I build my test with this CMake file:</p>
  
  <pre><code>link_directories(
      ${PROJECT_BINARY_DIR}
  )
  add_definitions("-std=c++11")
  add_executable(
      test
      spec.cpp
  )
  target_link_libraries(
      test
      timage
  )
  </code></pre>
  
  <p>Everything works just as expected. I am currently trying to find out what CMake is doing that I am not.</p>