[CMake] CMAKE_CURRENT_SCRIPT_DIR?

Brian Little brian.little at emergent.net
Tue Nov 7 13:39:07 EST 2006


You can use CMAKE_CURRENT_SOURCE_DIR for the current directory of the script
it is processing and CMAKE_CURRENT_BINARY_DIR for the directory it is going
to generate the project/make files in.  

Brian

-----Original Message-----
From: cmake-bounces+brian.little=emergent.net at cmake.org
[mailto:cmake-bounces+brian.little=emergent.net at cmake.org] On Behalf Of
Michael G. Hansen
Sent: Tuesday, November 07, 2006 1:10 PM
To: Lloyd Hilaiel
Cc: cmake at cmake.org
Subject: Re: [CMake] CMAKE_CURRENT_SCRIPT_DIR?

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
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list