-
Notifications
You must be signed in to change notification settings - Fork 758
cmake: option to install thrust when used via add_subdirectory() #1297
Conversation
LGTM -- thanks for the PR, I'll merge this soon. Heads up that I'll need to squash this down to a single commit before merging to simplify our internal integration process. |
Not a problem. |
daf9172
to
fae2c8d
Compare
cmake/install: mv ThrustAddSubdir handling to after project() We want to add the option to install in this case, which requires the paths set by project() thrust: separate out determination of whether Thrust is top-level project This determines whether an install target will be provided. If Thrust is built as top-level project, the install target will be provided by default, as before. If Thrust is built as a sub-project, the install target will, by default, not be provided, again maintaining existing behavior. So what's new here is that via this option a downstream project can enable install of thrust if it is used via `add_subdirectory`. Update CONTRIBUTING.md with new CMake option docs.
fae2c8d
to
7714602
Compare
Tested locally, looks good. I changed the name of the variable to I'm going to hold off on merging this so I can make the same changes to CUB at the same time. |
Sounds fine to me. There doesn't seem to be a standard naming convention for the install functionality, so there's no harm in adding yet another one ;) (some selection: |
Specifically, this ports the following PRs to CUB: - NVIDIA/thrust#1297 Add install rule option for add_subdirectory users. - NVIDIA/thrust#1298 Enforce semantic versioning in CMake version configs. - NVIDIA/thrust#1300 Use FindPackageHandleStandardArgs in CMake config.
Specifically, this ports the following PRs to CUB: - NVIDIA/thrust#1297 Add install rule option for add_subdirectory users. - NVIDIA/thrust#1298 Enforce semantic versioning in CMake version configs. - NVIDIA/thrust#1300 Use FindPackageHandleStandardArgs in CMake config.
This is about the case where a downstream library pulls in Thrust via
add_subdirectory()
. In this case, when the library is installed, it may want to also install Thrust together with it, as it's presumably needed to use the library (in particular, if the library's public header include thrust headers.)This PR adds an option
THRUST_INSTALL
to Thrust. The default install behavior is unchanged, ie., when Thrust is built stand-alone, it will be installed onmake install
, and when Thrust is pulled in viaadd_subdirectory()
, it won't install itself. But in the case described above, the downstream project canset(THRUST_INSTALL ON)
before theadd_subdirectory()
so that the downstream library's install will contain Thrust.