[CMake] How can i get the working directory
Mathieu Malaterre
mathieu.malaterre at kitware.com
Mon Oct 17 13:07:55 EDT 2005
Martin Baumann wrote:
> Hi,
>
> within my CMakeLists.txt I need a variable with the absolut path of the project I want to compile.
>
> Example:
>
> martin at mlaptop:~>cd /local/src/myProgram
> martin at mlaptop:~/local/src/myProgram>cmake .
>
> => in this example I would need to get the value '/home/martin/local/src/myProgram' in an variable or somehow else
>
> Or can I referre to subdirectories of myProgram?
You can use: CMAKE_CURRENT_SOURCE_DIR/CMAKE_CURRENT_BINARY_DIR
Or if you project is declared as let say PROJECT(Martin)
you can use: Martin_SOURCE_DIR/Martin_BINARY_DIR
HTH
Mathieu
More information about the CMake
mailing list