title: How to generate __init__.py in all subdirectories of current directory in cmake?
body: <p>I use an out-of-tree builds with CMake.
  I have a CMake custom command that generates *_pb2.py files from proto-files.
  Since proto-files may reside in an unknown number of subdirectories (package namespace), like <code>$SRC/package1/package2/file.proto</code>, then the build directory will contain something like <code>$BLD/package1/package2/file_pb2.py</code>.</p>
  
  <p>I want to implicitly make packages from auto-generated *_pb2.py files and, thus, I want to automagically generate __init__.py files in all subfolders (<code>$BLD/package1</code>, <code>$BLD/package1/package2</code>, etc.) and then install them.</p>
  
  <p>How can I do that?</p>
  
  <p><em>P.S.</em> I've tried macro from <a href="https://stackoverflow.com/questions/7787823/cmake-how-to-get-the-name-of-all-subdirectories-of-a-directory">CMake : How to get the name of all subdirectories of a directory?</a> (changed <strong>GLOB</strong> to <strong>GLOB_RECURSE</strong>) but it returns only subdirs that contain files. I can't get <code>package1</code> subdir from example above.</p>