title: In CMake, how can I find the directory of an included file?
body: <p>Suppose my project's <code>CMakeLists.txt</code> includes <code>foo.cmake</code>:</p>
  
  <pre><code>include(foo)
  </code></pre>
  
  <p>In <code>foo.cmake</code>, i want to know the path of <code>foo.cmake</code>. 
  <br />How can I do that?</p>
  
  <p>Note that <code>CMAKE_CURRENT_LIST_DIR</code> gives the directory of the including <code>CMakeLists.txt</code>, not that of the included <code>foo.cmake</code>, and is thus not what I want.</p>
  
  <p>Of course, <code>foo.cmake</code> might be included by several projects (i.e., by several <code>CMakeLists.txt</code> files).</p>