Assuming that you have 2 folders src
and build
where src
contains your projects and build
is the empty folder that you just created so you can deploy your out-of-tree build in it: CMAKE_SOURCE_DIR
is the path to src
where CMAKE_BINARY_DIR
points to build
.
Note that if you are doing an in-tree build, the 2 cache entries get the same value.
link: CMake Useful Variables .
EDIT
for further clarifications
<some location>/src/CMakeLists.txt ( so *src* is the root of your project )
<some location>/build
if you do something like
cd <some location>/build
cmake <some location>/src
you are making an out-of-tree build where CMAKE_SOURCE_DIR
and CMAKE_BINARY_DIR
get different values