Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Issue 1408993007: Change CMAKE_SOURCE_DIR to CMAKE_CURRENT_LIST_DIR. (Closed)

Created:
5 years, 1 month ago by Ian Ni-Lewis (Google)
Modified:
5 years, 1 month ago
CC:
gyp-developer_googlegroups.com
Base URL:
https://chromium.googlesource.com/external/gyp.git@master
Target Ref:
refs/heads/master
Project:
gyp
Visibility:
Public.

Description

Change 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -7 lines) Patch
M pylib/gyp/generator/cmake.py View 1 2 6 chunks +7 lines, -7 lines 0 comments Download

Messages

Total messages: 11 (4 generated)
bungeman-chromium
Note that one needs to actually 'Publish+Mail Comments' for an email to be sent out ...
5 years, 1 month ago (2015-11-04 14:51:30 UTC) #4
bungeman-chromium
https://codereview.chromium.org/1408993007/diff/20001/pylib/gyp/generator/cmake.py File pylib/gyp/generator/cmake.py (right): https://codereview.chromium.org/1408993007/diff/20001/pylib/gyp/generator/cmake.py#newcode1129 pylib/gyp/generator/cmake.py:1129: SetVariable(output, 'builddir', '${CMAKE_CURRENT_LIST_DIR}') Now this I object to. This ...
5 years, 1 month ago (2015-11-04 14:55:49 UTC) #5
bungeman-chromium
https://codereview.chromium.org/1408993007/diff/20001/pylib/gyp/generator/cmake.py File pylib/gyp/generator/cmake.py (right): https://codereview.chromium.org/1408993007/diff/20001/pylib/gyp/generator/cmake.py#newcode1129 pylib/gyp/generator/cmake.py:1129: SetVariable(output, 'builddir', '${CMAKE_CURRENT_LIST_DIR}') On 2015/11/04 14:55:49, bungeman2 wrote: > ...
5 years, 1 month ago (2015-11-04 15:00:12 UTC) #6
Ian Ni-Lewis (Google)
Fixed builddir. https://codereview.chromium.org/1408993007/diff/20001/pylib/gyp/generator/cmake.py File pylib/gyp/generator/cmake.py (right): https://codereview.chromium.org/1408993007/diff/20001/pylib/gyp/generator/cmake.py#newcode1129 pylib/gyp/generator/cmake.py:1129: SetVariable(output, 'builddir', '${CMAKE_CURRENT_LIST_DIR}') On 2015/11/04 15:00:12, bungeman2 ...
5 years, 1 month ago (2015-11-05 13:56:11 UTC) #7
Mark Mentovai
I don’t know cmake, but LGTM. If bungeman knows cmake, I defer to his review.
5 years, 1 month ago (2015-11-05 14:28:46 UTC) #8
bungeman-chromium
lgtm
5 years, 1 month ago (2015-11-05 14:41:27 UTC) #10
bungeman-chromium
5 years, 1 month ago (2015-11-05 19:37:42 UTC) #11
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
0f5bae131e582e4cecc417d13ea0b8de440135c5 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698