title: How to install Python package with CMake
body: <p>I have a very simple Python 3 package as part of a bigger project (which is mostly non-Python) that I want to install in the Python path with CMake.  Let us assume the following source code directory structure:</p>
  
  <pre><code>|
  +---&gt; pypackage
  |         |
  |         +--&gt; __init__.py
  |         |
  |         \--&gt; pymodule.py
  |
  much other stuff
  </code></pre>
  
  <p>For example on Ubuntu, I'd like to have pypackage/ end up in <code>/usr/lib/python3/dist-packages</code>.  Any Python script containing</p>
  
  <pre><code>from pypackage import pymodule
  </code></pre>
  
  <p>must work fine after the installation.</p>
  
  <p>"<a href="https://stackoverflow.com/questions/1242904">Finding python site-packages directory with CMake</a>" suggests to call Python from CMake to find out this path and store it in a CMake variable.  This looks like a hack to me, and the answers there are rather old.  Is there a canonical way to do this (pretty normal thing IMHO) in CMake?</p>