How to get the path to the currently included cmake file in a function?
<p>suppose I have this:</p>

<pre><code>#root/CMakeLists.txt
include(folder/file.cmake)
foo()
</code></pre>

<p>and</p>

<pre><code>#root/folder/file.cmake
function(foo)
    message(${SOME_SPECIAL_CMAKE_VARIABLE})
endfunction()
</code></pre>

<p>And I want to get <code>path/to/root/folder</code> printed.
I tried these 2 but they don't get me what I want: <code>CMAKE_CURRENT_LIST_DIR</code> or <code>CMAKE_CURRENT_SOURCE_DIR</code>.</p>

<p>So is there a cmake variable that will get me what I want?</p>

<p>Or is there a way to get the full path to <code>file.cmake</code> so I can atleast get it's path that way?</p>