Commit Graph
171 Commits
Author SHA1 Message Date
Arha Gatram f2d5320d42 FindCUDAToolkit: Add CUDAToolkit:: namespace targets
Changes target namespace to CUDAToolkit to match module name. Adds ALIAS
targets with the old CUDA:: namespace to maintain backwards
compatibility.

Issues: #27786
2026-07-20 15:59:26 -07:00
Robert Maynard 5f2b27562e FindCUDAToolkit: Add support for windows arm64 2026-06-23 16:43:04 -04:00
Robert Maynard afb9e1eab8 FindCUDAToolkit: Detect target processor even when not cross-compiling 2026-06-23 14:31:18 -04:00
Arha Gatram 507b641639 FindCUDAToolkit: Add cufilt target for CUDA 11.4 and above
Fixes: #26705
2026-05-28 10:03:34 -04:00
Kyle Edwards af0828cbbf FindCUDAToolkit: Link CUDA::nvml_static against DL libraries
And fix a potential failure mode where CUDA::sanitizer was already
added in a different project.
2026-05-13 16:30:30 -04:00
scivision 7406f0be82 Modules: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
Capture `execute_process` calls' `RESULT_VARIABLE`.

We don't actually need to check the result as we presume the existing
logic is already adequate, and sometimes programs return non-zero values
as result of valid query.  I.e. this is a "safe" way to broadly protect
these scripts.

Issue: #27782
2026-05-07 13:36:36 -04:00
Kyle Edwards a83b2de6ce FindCUDAToolkit: Fix search for sanitizer in cross-compilation
In a cross-compilation environment, `CUDAToolkit_LIBRARY_ROOT` will
be relative to the nvcc executable, rather than the cudart library,
due to `version.json` being relative to nvcc. However,
`CUDAToolkit_LIBRARY_SEARCH_DIRS` will be set correctly, so use
`EXTRA_PATH_SUFFIXES` to search relative to each entry in the list.
2026-04-30 09:55:41 -04:00
Kyle Edwards 35747cb5e0 FindCUDAToolkit: Add sanitizer support 2026-04-28 10:13:20 -04:00
Kyle Edwards 2a56da6447 FindCUDAToolkit: Fix issue with CUDAToolkit_LIBRARY_ROOT
This directory is accidentally set to the target directory in some
environments, so strip the target portion.
2026-04-24 13:28:26 -04:00
Robert Maynard ccf4ddab30 CUDAToolkit: CUDA::nvJitLink_static depends on nvptxcompiler_static
Fixes: #27666
2026-03-04 14:19:39 -05:00
Ben Boeckel 108d86f28d Modules/*Compiler: reword errors about invalid variable settings
The prior wording could be confusing if "compiler set" is detected as a
noun rather than "set" as a verb.

See: https://discourse.cmake.org/t/cmake-3-29-can-not-find-compiler-set-for-intel-ifx/11712
2026-02-20 09:03:23 -05:00
Kyle Edwards 2d2036c9e9 FindCUDAToolkit: Add CUDA::bin2c target 2026-01-12 12:02:07 -05:00
Brad King 32ee984b60 Merge topic 'find_cuda_toolkit_run_nvcc_with_ccbin'
4c3480fc0a CUDAToolkit: Use correct target paths from nvcc when cross-compiling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11228
2025-10-14 11:43:28 -04:00
Robert Maynard 4c3480fc0a CUDAToolkit: Use correct target paths from nvcc when cross-compiling
This fixes issues where FindCUDAToolkit would find host
host platform libraries when nvcc -ccbin pointed to compiler of
a different CPU architecture.
2025-10-13 11:04:10 -04:00
Robert Maynard a345c0e193 FindCUDAToolkit: Don't keep searching when CUDAToolkit_ROOT is set
Don't continue to search other locations for CUDA if the user
has specified a location and we fail to find it.
2025-10-06 11:17:16 -04:00
Peter Kokot 0fedf1592c Find*: Update *_FOUND variables
This marks all `<PACKAGENAME>_FOUND` result variables as deprecated
where possible (for `<PackageName>` find modules) to make it clearer
which variable to use.

In CMake 3.3, the FindPackageHandleStandardArgs module was refactored to
set both `<PackageName>_FOUND` and uppercase `<PACKAGENAME>_FOUND`
result variables to the same values. Before that, the FOUND_VAR argument
could be used to set the result variable.

* FindMatlab: Uppercased MATLAB_FOUND is not mentioned as it was never
  documented.
* Documentation for FindPythonInterp and FindPythonLibs modules synced
  accordingly to their deprecation (3.12 instead of 4.2).
* OPENGL_FOUND: deprecation version synced with other find modules.
* DevIL_FOUND was introduced in CMake 3.8. The uppercased variant not
  mentioned as it was previously never documented.

Fixes: #27242
2025-09-23 21:40:58 +02:00
Brad King 2913f8b2ed Merge topic 'find_cuda_toolkit_move_more_logic_into_functions'
f757721ecd CUDAToolkit: Refactor find failure error messages to a single macro
0ae76a89b1 CUDAToolkit: Refactor guessing toolkit logic into a function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11207
2025-09-21 18:32:11 -04:00
Robert Maynard f757721ecd CUDAToolkit: Refactor find failure error messages to a single macro 2025-09-19 11:36:20 -04:00
Robert Maynard aed29e04bc CUDAToolkit: Prefer CUDAToolkit_ROOT over users PATH path
Fixes #27102
2025-09-18 14:59:53 -04:00
Robert Maynard 0ae76a89b1 CUDAToolkit: Refactor guessing toolkit logic into a function 2025-09-18 14:56:52 -04:00
Peter Kokot 1d0b46111e Help: Add remaining intro code blocks to modules
This is a follow-up to add intro code blocks to all remaining utility
and find modules.

Fixes: #26555
2025-08-18 11:52:56 +02:00
Peter Kokot 1526655507 Find*: Add intro code blocks
- Added intro code blocks showing how to use find modules.
- Synced modules documentation.
- Extended few examples to make the intro code blocks fit into the
  modules descriptions.
- Synced some RST formatting, variables descriptions and positions.
- Removed few redundant internal comments.

Issue: #26555
2025-08-04 21:26:12 +02:00
Robert Maynard c88d5cdd06 CUDAToolkit: Add CUDA 12.9 nvtx3 updates
Starting in CUDA 12.9 the `nvToolsExt` library is no longer provided.
C and C++ projects should switch over to `nvtx3`.

Projects that previously used `nvToolsExt` with Fortran, can now use the
new `CUDA::nvtx3_interop` target for the same functionality with the new
NVTX v3 API.
2025-06-17 09:55:21 -04:00
Brad King b01c1df41b Merge topic 'cuda-nvcc-system-includes'
d2be863b5e CUDA: Add include paths from nvcc SYSTEM_INCLUDES entry

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10857
2025-06-06 08:12:49 -04:00
Robert Maynard d2be863b5e CUDA: Add include paths from nvcc SYSTEM_INCLUDES entry
Upcoming versions of nvcc are adding support for `SYSTEM_INCLUDES`
which contain includes that are implicitly used with `-isystem`
instead of `-I`.

Support of this is needed in CMake as some CUDA Toolkit releases will
start to have a different include directory layout and using only the
output from `INCLUDES` will be insufficient to find all headers.
2025-06-05 10:53:12 -04:00
Brad King d8e9b1bbdf FindCUDAToolkit: Simplify internal documentation links 2025-06-04 19:40:04 -04:00
Brad King db9b79fb9b FindCUDAToolkit: Update documentation URLs 2025-06-04 19:40:00 -04:00
Brad King 1049b0d9a5 FindCUDAToolkit: Fix documentation link to cuRAND section 2025-06-04 11:37:19 -04:00
Brad King 4f2482700b FindCUDAToolkit: Fix cross-compiling without CMAKE_SYSTEM_PROCESSOR
Previously we relied on the cross-compiling toolchain file to set
`CMAKE_SYSTEM_PROCESSOR` to a value consistent with the CUDA compiler's
target architecture.  When a compiled language is enabled, we now have
its target architecture in `CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID`.
Use that to select the CUDA toolkit's corresponding target directory.

If no language is enabled, or the compiler's target architecture is not
known, fall back to `CMAKE_SYSTEM_PROCESSOR`.  If that is not set, fail
with an explicit error make clear what is wrong.
2025-03-27 10:21:57 -04:00
Brad King 48460d22aa Merge topic 'FindCUDAToolkit-cupti'
cbb8f30ee6 CUDAToolkit: Restore ability to find cupti library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !10533
2025-03-27 09:10:32 -04:00
Brad King d5d7175d9c Merge topic 'FindCUDAToolkit-cupti' into release-3.31
cbb8f30ee6 CUDAToolkit: Restore ability to find cupti library

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10533
2025-03-27 09:09:47 -04:00
Marcus D. Hanwell cbb8f30ee6 CUDAToolkit: Restore ability to find cupti library
In commit f69b9b7305 (CUDAToolkit: Restore ability to find cupti
headers, 2023-12-08, v3.28.1~8^2) we did not update the CUPTI library
searches to add the extra search path needed for certain install layouts
(only the header search path). Add the additional library search paths.

Fixes: #26770
Issue: #25484
2025-03-26 14:03:34 -04:00
Brad King 40eeca77c3 CUDA/Clang: Sync target directory table with FindCUDAToolkit
Since commit 6636693134 (FindCUDAToolkit: Re-unify with
Internal/CUDAToolkit, 2020-06-11, v3.18.0-rc2~6^2~7) the table is
duplicated.

Update the CUDA target directory table for Clang to account for changes
to the equivalent table in FindCUDAToolkit:

* commit bcdd486bf7 (CUDA: Enable support on QNX, 2020-10-30,
                     v3.19.0-rc3~8^2~1)
* commit 743d4181b4 (FindCUDAToolkit: Support cross-compilation to
                     sbsa-linux, 2023-01-11, v3.26.0-rc1~118^2)
2025-03-04 13:51:29 -05:00
Brad King 05efcdd464 FindCUDA: Sync target directory table with FindCUDAToolkit
The table has been duplicated since commit 69fcad9332 (CUDAToolkit: Add
support for cross-compiling, 2020-01-21, v3.17.0-rc1~104^2~1).
2025-03-04 13:51:29 -05:00
Kitware Robot 1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Connor Baker c5d81a2468 FindCUDAToolkit: Fix precondition for dependency on Threads
`FindThreads` requires that C or CXX be enabled.  Previously we were
only checking that `CMAKE_{C,CXX}_COMPILER` have been set, which does
not mean the languages have been enabled.
2025-02-16 11:21:18 -05:00
Nikita Nemkin d138555959 Help: Use Title Case for all "Imported Targets" sections 2025-01-31 12:23:29 -05:00
Brad King 7afa58b15d Modules/Find*: Include FindPackageHandleStandardArgs normally
Since commit d74210a8bd (CMP0017: Remove support for OLD behavior,
2024-11-17) we can rely on CMP0017's NEW behavior unconditionally.
Calling `include(FindPackageHandleStandardArgs)` in a builtin module
will always get the builtin `FindPackageHandleStandardArgs`.
2025-01-30 08:53:12 -05:00
Alex Turbov bc8621d999 Fix: A lot of typos in code found by typos
Yet another great code spellchecker: https://github.com/crate-ci/typos/

(Will be added later as a `pre-commit` hook)
2025-01-12 18:49:34 +04:00
Seth R Johnson fb0b3d1585 FindCUDAToolkit: Remove debug message
This was left accidentally by commit 587c0443cc (FindCUDAToolkit:
Support CUDA version extraction from version.json, 2023-05-02,
v3.26.4~3^2).
2024-10-25 08:32:00 -04:00
Robert Maynard 9d29544082 FindCUDAToolkit: nvrtc shouldn't hard depend on nvJitLink
The dependency on nvJitLink was due to misunderstanding how runtime compiled code that uses
LTO is used. It doesn't require nvrtc to have a dependency on nvJitLink, just the caller.
2024-10-14 10:16:29 -04:00
Robert Maynard 7671a2f4c1 CUDAToolkit: nvrtc shouldn't hard depend on nvrtc-builtins
Depending on nvrtc-builtins breaks CUDA enhanced compatibility across
minor versions. The static version of nvrtc continues to need the
dependency due to undefined symbols
2024-10-09 11:58:04 -04:00
Brad King fb303f6086 Merge topic 'FindCUDAToolkit-clear-failure'
8f974011ea FindCUDAToolkit: Allow new search locations after failure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9650
2024-07-19 10:04:17 -04:00
Brad King 078eb8d79d Merge topic 'FindCUDAToolkit-windows-only'
973b019363 FindCUDAToolkit: Refactor search windows only search directories

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9648
2024-07-18 09:01:16 -04:00
Robert Maynard 973b019363 FindCUDAToolkit: Refactor search windows only search directories
Will allow us to better support layout changes going forward
2024-07-17 10:47:34 -04:00
Kyle Edwards b3f02006f0 FindCUDAToolkit: Add ability to find static version of nvml
Fixes: #26131
2024-07-15 10:35:36 -04:00
Robert Maynard 8f974011ea FindCUDAToolkit: Allow new search locations after failure
Fixes #22010
2024-07-10 09:44:57 -04:00
Robert Maynard eed16fbc00 FindCUDAToolkit: Use CUDA compiler path even when CUDA lang not enabled
Fixes: #25567
2024-05-29 14:39:29 -04:00
Brad King 5ec306fb13 FindCUDAToolkit: Replace a documentation link with its permanent redirect 2024-04-23 08:02:54 -04:00
Brad King 480cf4a714 FindCUDAToolkit: Replace documentation links with their permanent redirects 2024-04-02 08:43:12 -04:00