title: Variables set with PARENT_SCOPE are empty in the corresponding child scope. Why?
body: <p>Consider the following minimal example:</p>
  
  <pre><code>.
  ├── bar
  │   └── CMakeLists.txt
  └── CMakeLists.txt
  </code></pre>
  
  <p>where <code>./CMakeLists.txt</code> is</p>
  
  <pre><code>project( foo )
  cmake_minimum_required( VERSION 2.8 )
  
  set( FOO "Exists in both, parent AND in child scope." )
  
  add_subdirectory( bar )
  message( STATUS "Variable BAR in ./     = ${BAR}" )
  message( STATUS "Variable FOO in ./     = ${FOO}" )
  </code></pre>
  
  <p>and <code>./bar/CMakeLists.txt</code> is</p>
  
  <pre><code>set( BAR "Exists in parent scope only." PARENT_SCOPE )
  message( STATUS "Variable BAR in ./bar/ = ${BAR}" )
  </code></pre>
  
  <p>The relevant part of the output of <code>cmake</code> is this:</p>
  
  <pre><code>...
  -- Variable BAR in ./bar/ =
  -- Variable FOO in ./bar/ = Exists in both, parent AND in child scope.
  -- Variable BAR in ./     = Exists in parent scope only.
  -- Variable FOO in ./     = Exists in both, parent AND in child scope.
  ...
  </code></pre>
  
  <p>Since the variable <code>BAR</code> is placed into the parent scope I would expect it to be available in the current child scope as well (and in those that follow) -- just like the variable <code>FOO</code>, which is defined the parent scope to begin with. But as can be seen in the above lines the 
  variable <code>BAR</code> is empty in <code>./bar/CMakeLists.txt</code>, which lead me to
  the following questions:</p>
  
  <p>Why is the <em>modified</em> parent scope not immediately accessible in the child 
  scope, <code>./bar/</code>? Can this be mitigated? If yes, how? And if no, what is a 
  work-around? Or am I completely missing something obvious?</p>
  
  <p>Context: my project consists of several executables and libraries. For a 
  library, e.g. <code>bar</code>, I'd like to set a variable <code>bar_INCLUDE_DIR</code> which 
  is added to the include paths of any depending executable, i.e. <code>target_include_directories( my_target PUBLIC bar_INCLUDE_DIR )</code>.</p>