xref: /aosp_15_r20/external/pytorch/cmake/Modules_CUDA_fix/README.md (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1This `./upstream` subfolder contains fixes for `FindCUDA` that are introduced in
2later versions of cmake but cause generator expression errors in earlier CMake
3versions. Specifically:
4
51. a problem where a generator expression for include directories was
6passed to NVCC, where the generator expression itself was prefixed by `-I`.
7As the NNPACK include directory generator expression expands to multiple
8directories, the second and later ones were not prefixed by `-I`, causing
9NVCC to return an error. First fixed in CMake 3.7 (see
10[Kitware/CMake@7ded655f](https://github.com/Kitware/CMake/commit/7ded655f)).
11
122. Windows VS2017 fixes that allows one to define the ccbin path
13differently between earlier versions of Visual Studio and VS2017. First
14introduced after 3.10.1 master version (see
15[Kitware/CMake@bc88329e](https://github.com/Kitware/CMake/commit/bc88329e)).
16
17The downside of using these fixes is that `./upstream/CMakeInitializeConfigs.cmake`,
18defining some new CMake variables (added in
19[Kitware/CMake@48f7e2d3](https://github.com/Kitware/CMake/commit/48f7e2d3)),
20must be included before `./upstream/FindCUDA.cmake` to support older CMake
21versions. A wrapper `./FindCUDA.cmake` is created to do this automatically, and
22to allow submodules to use these fixes because we can't patch their
23`CMakeList.txt`.
24
25If you need to update files under `./upstream` folder, we recommend you issue PRs
26against [the CMake mainline branch](https://gitlab.kitware.com/cmake/cmake/tree/master/Modules/FindCUDA.cmake),
27and then backport it here for earlier CMake compatibility.
28