title: Linking static libraries with c++/cmake
body: <p>I try to link libraries in my program using firebreath framework.</p>
  
  <p>So I add this code in projectDef.cmake.</p>
  
  <pre><code>include_directories(/usr/include/giblib)
  include_directories(/usr/include/X11)
  
  add_library(giblib_ptm STATIC IMPORTED) 
  set_property(TARGET giblib_ptm PROPERTY IMPORTED_LOCATION /usr/lib/libgiblib.a)
  
  add_library(X11_ptm STATIC IMPORTED) 
  set_property(TARGET X11_ptm PROPERTY IMPORTED_LOCATION /usr/lib/i386-linux-gnu/libX11.a)
  
  add_library(Imlib_ptm STATIC IMPORTED) 
  set_property(TARGET Imlib_ptm PROPERTY IMPORTED_LOCATION /usr/lib/libImlib2.a)
  
  target_link_libraries(Printmade2 giblib_ptm X11_ptm Imlib_ptm)
  </code></pre>
  
  <p>Why I add <strong>'include_directories'</strong> is I include header file in my .cpp file.</p>
  
  <pre><code>#include &lt;giblib.h&gt;
  #include &lt;Xlib.h&gt;
  </code></pre>
  
  <p>After execute <strong>make</strong>, this error message appears.</p>
  
  <pre><code>/usr/lib/i386-linux-gnu/libX11.a(OpenDis.o): In function `OutOfMemory':
  (.text+0x459): undefined reference to `xcb_disconnect'
  /usr/lib/i386-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay':
  (.text+0x8f5): undefined reference to `xcb_get_setup'
  /usr/lib/i386-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay':
  (.text+0xedb): undefined reference to `xcb_get_maximum_request_length'
  /usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
  (.text+0x176): undefined reference to `xcb_parse_display'
  /usr/lib/i386-linux-gnu/libX11.a(xcb_disp.o): In function `_XConnectXCB':
  (.text+0x1d7): undefined reference to `xcb_connect_to_display_with_auth_info'
  ...
  /usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `poll_for_event':
  (.text+0x30e): undefined reference to `xcb_poll_for_event'
  /usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `poll_for_response':
  (.text+0x6b4): undefined reference to `xcb_poll_for_reply'
  /usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XSend':
  (.text+0x85f): undefined reference to `xcb_writev'
  /usr/lib/i386-linux-gnu/libX11.a(xcb_io.o): In function `_XReadEvents':
  (.text+0xa1f): undefined reference to `xcb_connection_has_error'
  ....
  </code></pre>
  
  <p>I think this error is cause by <strong>'add_library'</strong> and <strong>'set_property'</strong>, </p>
  
  <p>but I can't understand why.</p>
  
  <p>What should I do for linking static libraries in my program?</p>