title: Reading variables into cmake from another CMakeLists.txt
body: <p>Using <code>Ubuntu</code>, <code>C++</code> and <code>cmake</code>, I want to create a program <code>Alpha</code> which is based upon code for another program,<code>Beta</code>. I already have the source code for <code>Beta</code>, and I need to write code for <code>Alpha</code> which uses this existing code. I am trying to keep everything neat, so I have a separate directory for <code>Alpha</code> and <code>Beta</code> source files, <code>Alpha.cpp</code> and <code>Beta.cpp</code>.</p>
  
  <p>Here is my directory structure:</p>
  
  <pre><code>/CMakeLists.txt
  /Alpha.cpp (the main function)
  /Beta
      /CMakeLists.txt
      /Beta.cpp
  </code></pre>
  
  <p>My <code>CMakeLists.txt</code> file for <code>Alpha</code> looks like this:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  project(Alpha)
  add_executable(Alpha Alpha.cpp Beta/Beta.cpp)
  </code></pre>
  
  <p>Now, in the original code for <code>Beta</code>, the <code>CMakeLists.txt</code> file has lots of information, such as checking the operating system, finding packages, and generally defining various cmake variables. I need to use those variables in the <code>CMakeLists.txt</code> file for <code>Alpha</code>, so that <code>Beta.cpp</code> is compiled properly.</p>
  
  <p>So, my question: is it possible to retain all of this information in <code>Beta/CmakeLists.txt</code>, without having to write it all out in <code>Alpha</code>'s <code>CMakeLists.txt</code> file? How do I then tell <code>Alpha</code>'s <code>CMakeLists.txt</code> file to read <code>Beta</code>'s <code>CMakeLists.txt</code> file to get these variables? I want to do this to keep everything neat, and to maintain modularity. Thanks!</p>