title: cmake finds wrong python libs
body: <p>I'm new to CMake and have trouble understanding some usage concepts.</p>
  
  <p>I'm calling a python script from a c++ program:</p>
  
  <pre><code>#include &lt;Python.h&gt;
  ...
  Py_Initialize();
  PyRun_SimpleFile(...);
  Py_Finalize();
  </code></pre>
  
  <p>The corresponding cmake entries in my cmake file are:</p>
  
  <pre><code>FIND_PACKAGE(PythonLibs REQUIRED)
  ...
  TARGET_LINK_LIBRARIES(MyApplication ${PYTHON_LIBRARIES})
  </code></pre>
  
  <p>This works as long as my python script isn't using any modules installed into the site-packages directory, otherwise I get an ImportError. <a href="https://stackoverflow.com/questions/1242904/finding-python-site-packages-directory-with-cmake">This question</a> shows how to find the location of the site-packages directory with CMake, but what should I tell CMake to do with it?</p>
  
  <p>EDIT: Problem solved. Turns out FIND_PACKAGE(PythonLibs) finds a different python installation from what I'm normally using (/usr/local/lib/libpython2.7.dylib instead of /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib - I'm on mac), which is how I get standard python modules, but none that I installed myself. To change the PYTHONPATH back to normal, I added</p>
  
  <pre><code>try:
    import some_package
  except ImportError:
    if "my_python_path" in sys.path: raise
    sys.path.append("my_python_path")
  </code></pre>
  
  <p>at the top of my python script.</p>