title: Boost python linking
body: <p>I'm adding boost.python for my Game. I write wrappers for my classes to use them in scripts. The problem is linking that library to my app. I'm using <code>cmake</code> build system.</p>
  
  <p>Now I have a simple app with 1 file and makefile for it:</p>
  
  <pre><code>PYTHON = /usr/include/python2.7
  
  BOOST_INC = /usr/include
  BOOST_LIB = /usr/lib
  
  TARGET = main
  
  $(TARGET).so: $(TARGET).o
      g++ -shared -Wl,--export-dynamic \
      $(TARGET).o -L$(BOOST_LIB) -lboost_python \
      -L/usr/lib/python2.7/config -lpython2.7 \
      -o $(TARGET).so
  
  $(TARGET).o: $(TARGET).cpp
      g++ -I$(PYTHON) -I$(BOOST_INC) -c -fPIC $(TARGET).cpp
  </code></pre>
  
  <p>And this works. It builds a 'so' file for me which I can import from python.</p>
  
  <p>Now the question: how to get this for cmake?</p>
  
  <p>I wrote in main <code>CMakeList.txt</code>:</p>
  
  <pre><code>...
  find_package(Boost COMPONENTS filesystem system date_time python REQUIRED)
  message("Include dirs of boost: " ${Boost_INCLUDE_DIRS} )
  message("Libs of boost: " ${Boost_LIBRARIES} )
  
  include_directories(
      ${Boost_INCLUDE_DIRS}
          ...
  )
  
  target_link_libraries(Themisto
      ${Boost_LIBRARIES}
      ...
  )
  ...
  </code></pre>
  
  <p><code>message</code> calls show:</p>
  
  <pre><code>Include dirs of boost: /usr/include
  Libs of boost: /usr/lib/libboost_filesystem-mt.a/usr/lib/libboost_system-mt.a/usr/lib/libboost_date_time-mt.a/usr/lib/libboost_python-mt.a
  </code></pre>
  
  <p>Ok, so I've added simple .cpp-file for my project with include of <code>&lt;boost/python.hpp&gt;</code>. I get an error at compiling:</p>
  
  <pre><code>/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
  </code></pre>
  
  <p>So it doesn't take all need include directories.</p>
  
  <p>And <strong>second</strong> question:</p>
  
  <p>How to organize 2-step building of script-cpp files? In makefile I showed there are <strong>TARGET.o</strong> and <strong>TARGET.so</strong>, how to process that 2 commands in cmake?</p>
  
  <p>As I understand, the best way is to create subproject and do something there.</p>
  
  <p>Thanks.</p>