title: CMake to Bazel Migration
body: <p>I'm converting CMake project to Bazel.</p>
  <p>I have top-level <code>CMakeLists.txt</code> which uses some global variables like <code>TYPE_A</code>, <code>TYPE_B</code>. There is another <code>CMakeLists.txt</code> which uses the above variables.</p>
  <p>Following is the folder structure</p>
  <p><a href="https://i.stack.imgur.com/WXwCq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WXwCq.png" alt="enter image description here" /></a></p>
  <p>Content of <code>CMakeLists.txt</code> inside &quot;app&quot; folder contains the following content.</p>
  <pre><code>option(TYPE_A &quot;A BUILD&quot; ON)
  option(TYPE_B &quot;B BUILD&quot; ON)
  </code></pre>
  <p>Content of <code>CMakeLists.txt</code> inside &quot;app2&quot; folder contains the following content.</p>
  <pre><code>if (${TYPE_A})
  //Do someprocesing
  endif()
  
  
  if(${TYPE_B})
  //Do someprocessing
  endif()
  </code></pre>
  <p>My question is how will I set the options which are present in CMakeLists.txt(inside &quot;app&quot; folder) in Bazel and access the same variables in the BUILD file inside the &quot;app2&quot; folder. In other words how will i bazelize &quot;app&quot; and &quot;app2&quot; packages?</p>