DescriptionChange CMAKE_SOURCE_DIR to CMAKE_CURRENT_LIST_DIR.
In projects with just one CMakeLists.txt, these two variables
are equivalent. In multiproject builds, however, CMAKE_SOURCE_DIR
always points to the top level CMakeLists.txt while
CMAKE_CURRENT_LIST_DIR points to the CMakeLists.txt that is currently
being evaluated. CMAKE_CURRENT_LIST_DIR was added in cmake 2.8.3.
The generator constructs paths relative to the generated CMakeLists.txt
rather than to the build root. Therefore, CMAKE_CURRENT_LIST_DIR is the
more appropriate variable.
This change makes it possible to integrate a gyp-generated cmake
into a multi-project build without needing to switch the entire
build over to gyp. It also enables projects where the top level
cmake is handwritten (and possibly responsible for running gyp
to generate other cmake files). This makes usage in IDEs a bit
more convenient; at the very least, it stops CLion from complaining
that the source files don't live underneath the directory where
CMakeLists.txt lives. This also works with KDevelop, which has had
support for CMAKE_CURRENT_LIST_DIR since 4.1.
Patch Set 1 #Patch Set 2 : fix builddir #
Total comments: 3
Patch Set 3 : set builddir to CMAKE_CURRENT_BINARY_DIR #Messages
Total messages: 11 (4 generated)
|