[CMake] CMAKE_CURRENT_SCRIPT_DIR?

Michael G. Hansen mikeml2 at pfna.de
Tue Nov 7 13:09:51 EST 2006


Hi,

there is CMAKE_CURRENT_LIST_FILE which returns the path to the currently
processed list-file and you can get the directory using
GET_FILENAME_COMPONENT:

GET_FILENAME_COMPONENT(path_of_current_script_dir
${CMAKE_CURRENT_LIST_FILE} PATH)

Note that there will be no slash at the end of path_of_current_script_dir.

I got the name of the variable from here:
http://www.cmake.org/Wiki/CMake_Useful_Variables

Greetings, Mike

Lloyd Hilaiel wrote:
> Howdy all,
> 
> Did some searching but couldn't find a means to determine the current
> directory in which the currently processed CMake file resides.
> 
> This is interesting for cases where the INCLUDE directive includes a 
> cmake file that wishes to include others relative to itself.
> 
> Is there a means of determining this information?
> 


-- 
Michael Hansen - http://www.pfna.de/
Monheim / Germany


More information about the CMake mailing list