100 Commits
Author SHA1 Message Date
Robert Maynard 00388f8576 cmake-cli: Deprecate -H
Fixes: #18341
2026-09-21 14:35:51 -04:00
Robert Maynard 616f65b379 Clang/CUDA: Warn when using offloading driver with RDC + PTX
Fixes: #28084
2026-09-15 11:01:04 -04:00
Robert Maynard 6131353bff Tests/Cuda: Skip unsupported case using Clang offloading driver with RDC + PTX
Issue: #28084
2026-09-14 11:18:21 -04:00
Robert Maynard 91f4a420cd Tests/Cuda: Remove redundant condition
`CMake_TEST_CUDA` must be set to enter this directory.
2026-09-14 11:17:35 -04:00
Robert Maynard 5b416cbe77 ci: add job testing cuda13.2 with clang 2026-09-03 13:26:46 -04:00
Robert Maynard 64dac60df9 ci: Update cuda13.2-x86_64 base image to clang-23 2026-09-03 13:26:45 -04:00
Robert Maynard ce3d0af576 Clang/CUDA: Support the llvm23+ offload linker model
Fixes: #26120, #26810
2026-09-03 13:26:45 -04:00
Robert Maynard a2e6306c27 GenEx/LINK_LIBRARY: Add NEEDED_LIBRARY support on Linux 2026-08-13 13:45:19 -04:00
Robert Maynard 158b64688f Linker/GNU: Refactor LINKER_PUSHPOP_STATE_SUPPORTED check to a function 2026-08-13 13:45:19 -04:00
Robert Maynard 0f784069c3 Tests: Consolidate RunCMake.target_link_libraries-LINK_LIBRARY conditions 2026-08-13 13:45:19 -04:00
Robert Maynard 2c181bd60a GoogleTest: Drop newlines from test names
It is possible to have trailing ( and maybe leading ) newlines in a test name. This causes problems with ctest
features like `tests-from-file` since they will never
be an exact match.

So now we sanitize names by removing these newlines
2026-07-16 15:11:53 -07:00
Robert Maynard b464920acc string(STRIP): Document that it removes newlines 2026-07-10 14:34:10 -04:00
Robert Maynard b6d3e9ba18 RPATH: Support CMAKE_SYSROOT value of /
Fixes: #27882
2026-06-25 13:53:08 -04:00
Robert Maynard bd629722bd CUDA: Support _CMAKE_FEATURE_DETECTION_TARGET_TYPE like all other languages 2026-06-25 13:22:02 -04:00
Robert Maynard 0e9d7128cd CUDA: Add support for Clang on Windows ARM64 2026-06-23 16:43:15 -04: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
Robert Maynard ef3681667f Diagnostics: Add CMD_INSTALL_ABSOLUTE_DIR for all install types
The original addition of CMD_INSTALL_ABSOLUTE_DIR by commit
39a56136a3 (Diagnostic: Add warn or error on absolute install paths,
2026-03-25) didn't cover all install signatures. Add checks to cover
those install types that weren't covered by the original commit.
2026-06-05 13:10:12 -04:00
Robert Maynard f9fe9884ac Diagnostics: CMD_INSTALL_ABSOLUTE_DIR follows CMake message style 2026-06-03 18:23:25 -04:00
Robert Maynard 30488911c7 CUDA: Better diagnostic error when compiler identification fails
Fixes: #27800
2026-05-08 09:48:31 -04:00
Robert Maynard 3f811dc56f Add target ordering dependencies guarded by $<COMPILE_ONLY> genex
`LINK_LIBRARIES` entries guarded by `$<COMPILE_ONLY:...>` are not
linked, but must participate in target ordering so files generated by
compile-only dependencies, like headers, are available before
compilation.

Fixes: #27792
2026-05-06 16:39:31 -04:00
Robert Maynard 39a56136a3 Diagnostic: Add warn or error on absolute install paths
Add `-Winstall-absolute-destination` diagnostic to warn or
error when an install command has an absolute destination.

This allow projects to enforce the best practice of not allowing
absolute install DESTINATIONS.
2026-04-29 09:22:29 -04:00
Robert Maynard 05bd3e5437 ci: Validate that the rvm-installer comes from the correct source
Based on guidance from https://rvm.io/rvm/security to make sure
we get rvm-installer from the correct source.
2026-04-28 15:37:50 -04:00
Robert Maynard 1304fb4027 PkgC: Make sure we don't use deleted stack objects
The cmPkgConfigEnv* of cmPkgConfigResult would point
to a deleted stack copy.

This can causes issues when cmPkgConfigResult::Libs()
is called and we have to fall back to querying the
env.
2026-04-27 13:35:57 -04:00
Robert Maynard fd76089631 cmInstallFileSetGenerator: Only support per config Destination. 2026-04-24 10:49:03 -04:00
Robert Maynard 84027b3863 cmInstallCommandArguments: Remove unreachable code-path 2026-04-17 15:43:18 -04:00
Robert Maynard def035dafd cmake install: Allow no spaces between j and parallel count 2026-03-19 11:15:48 -04:00
Robert Maynard accabeb272 install: Add option to use project name as default component
Teach `CMAKE_INSTALL_DEFAULT_COMPONENT_NAME` to accept a special
`<PROJECT_NAME>` placeholder.

Fixes: #27682
2026-03-17 10:33:44 -04:00
Robert Maynard bd605ba9e6 cmake --install: Support multiple --components
Issue: #25178
2026-03-09 13:47:58 -04:00
Robert Maynard f059d95484 cmInstallScriptHandler: Now handles adding the component to install 2026-03-05 10:06:01 -05:00
Robert Maynard ccf4ddab30 CUDAToolkit: CUDA::nvJitLink_static depends on nvptxcompiler_static
Fixes: #27666
2026-03-04 14:19:39 -05:00
Robert MaynardandBrad King d314cad7f1 Ninja,Make,FASTBuild: Avoid unnecessary Windows short paths in placeholders
Only the classic Borland `make` and Watcom `wmake` tools need short paths.

Co-authored-by: Brad King <brad.king@kitware.com>
Fixes: #16138
2026-02-24 11:56:23 -05:00
Robert Maynard 37777a66e3 CUDA: Handle env variables that clash with nvcc magic keywords
On windows when you run `nvcc -v` all the env variables will
be printed before nvcc verbose output. This allows us to handle
the cases where env variable exists with the same name as a magic
nvcc keyword we parse
2026-02-14 15:54:46 -05:00
Robert Maynard c238f174a9 Tests: Remove invalid CUDA code from tests
Multiple tests passed a host side stack address for writing on the GPU.
Now we pass a GPU backed heap address.
2026-01-20 16:25:03 -05:00
Robert Maynard bf4a63c7b0 Help: Document that enable_language cannot be used in block()
Issue: #27389
2026-01-13 11:16:54 -05:00
Robert Maynard d4aec0ff07 FindOpenMP: Improve robustness when a language isn't enabled.
Previously we would generate a if statement with `OR STREQUAL` when
${CMAKE_${LANG}_COMPILER_ID} evaluated to an empty string
2026-01-05 09:23:11 -05: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
Robert Maynard 87a661a916 find_package: Fix regression on <PackageName>_ROOT relative to CWD
In commit 9d44a77454 (find_*: Explicitly normalize found paths as they
exist on disk, 2024-10-17, v4.0.0-rc1~597^2~1), we removed path
normalization from the internal `cmSearchPath::AddPathInternal` helper.
Most call sites were updated to normalize input paths first, but search
paths derived from `<PackageName>_ROOT` CMake variables are no longer
normalized.  Instead we normalize the path to the file found after
searching.

When `find_package` "config" mode considers a candidate CMake package
configuration file, normalize its path before loading the adjacent
package version file so that the latter is loaded by absolute path.
Otherwise `cmMakefile::ReadDependentFile` interprets a relative path
with respect to the current source directory rather than the current
working directory.

Fixes: #27279
2025-10-02 15:30:13 -04:00
Robert Maynard ab0a44a0a0 find_package: Fix regression on <PackageName>_ROOT relative to CWD
In commit 9d44a77454 (find_*: Explicitly normalize found paths as they
exist on disk, 2024-10-17, v4.0.0-rc1~597^2~1), we removed path
normalization from the internal `cmSearchPath::AddPathInternal` helper.
Most call sites were updated to normalize input paths first, but search
paths derived from `<PackageName>_ROOT` CMake variables are no longer
normalized.  Instead we normalize the path to the file found after
searching.

When `find_package` "config" mode considers a candidate CMake package
configuration file, normalize its path before loading the adjacent
package version file so that the latter is loaded by absolute path.
Otherwise `cmMakefile::ReadDependentFile` interprets a relative path
with respect to the current source directory rather than the current
working directory.

Fixes: #27279
2025-10-02 15:24:47 -04:00
Robert Maynard 72b8814f85 CUDA: Properly construct CUcontext in tests 2025-09-24 08:28:54 -04:00
Robert Maynard f25982c422 CUDA: Update all tests to support NPPIF CUDA 13 deprecations 2025-09-24 08:28:33 -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
Robert Maynard 67c102ef64 Clang/CUDA: Support CUDA Toolkit 13 new include layout
This ensures that clang knows about the two includes that are required for CUDA 13.
2025-08-14 09:55:53 -04:00
Robert Maynard 3ff777de12 CUDA: Update CUDA tests to handle CUDA 13 deprecations 2025-08-04 11:22:13 -04:00
Robert Maynard bbf732525a CUDA: Add CUDA 13.0 support to 'all' and 'all-major' architecture tables 2025-08-04 11:22:12 -04:00
Robert Maynard 8beb309b79 CUDA: Make sure CUDA architectures are in order
Make sure we always group major versions together instead
of interleaving 100 and 120 families.
2025-08-04 11:06:45 -04:00
Robert Maynard bf442068bb CUDA: Improve error message for nonexistent compiler paths
Fixes: #25709
2025-07-08 09:58:37 -04: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
Robert Maynard ea6b29a367 NVHPC: Add support for 25.07 no-pie option 2025-06-09 14:36:07 -04:00
Robert Maynard 8ef90ffc52 NVHPC: Add support for COMPILE_OPTIONS_VISIBILITY 2025-06-05 15:12:45 -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
Robert Maynard b2425fdffd HIP: Store CMAKE_HIP_HOST_COMPILER as an absolute path 2025-05-20 12:41:39 -04:00
Robert MaynardandBrad King fdb8f0f588 CUDA: Store CMAKE_CUDA_HOST_COMPILER as an absolute path
Isolate its selection from later changes to `PATH`.

Fixes: #26942
Co-authored-by: Brad King <brad.king@kitware.com>
2025-05-20 11:07:38 -04:00
Robert Maynard b62f3257f2 CUDA/Clang: Update nvcc default architectures with CUDA 13 deprecations
As outlined in the CUDA 12.9 release notes sm_5X, sm_6X, and sm_70
are being removed in CUDA 13:

> Maxwell, Pascal, and Volta architectures are now feature-complete with
> no further enhancements planned. While CUDA Toolkit 12.x series will
> continue to support building applications for these architectures,
> offline compilation and library support will be removed in the next
> major CUDA Toolkit version release.
2025-05-13 09:40:00 -04:00
Robert Maynard a1b4c30f24 CUDA: Add CUDA 12.9 new architectures and family syntax 2025-05-02 15:46:49 -04:00
Robert Maynard b2251e0deb CUDA/Clang: Update architectures supported by CUDA 12.8 2025-05-02 15:46:06 -04:00
Robert Maynard 83a0c72a2d ci: Tell CudaOnly.CompileFlags test what specific architecture to use
CUDA 12.8 deprecates architectures below 75.  Presumably a future
version will remove it.  Prepare infrastructure to avoid relying on
hard-coded arch 50 in this test.

This extends commit 63a5460faf (ci: Tell CudaOnly.Architecture test what
specific architecture to use, 2025-04-21).
2025-04-23 09:28:13 -04:00
Robert Maynard f5837f0ac9 cmFindBase: Don't pass vector::erase an out of bounds iterator
Fixes: #26606
2025-02-11 14:59:21 -05:00
Robert Maynard a745b6869e CUDA/Clang: Update architectures supported by CUDA 12.8 2025-02-04 12:21:16 -05:00
Robert Maynard c87004fdc3 COMPILE_ONLY: Genex now stops object libraries from linking
Previously we didn't properly exclude $<COMPILE_ONLY:OBJECT lib>
from the right hand side of  `target_link_libraries`.

Fix the update that commit 73337cb383 (LINK_LIBRARIES: Evaluate
separately for linking and usage requirements, 2022-03-22,
v3.24.0-rc1~404^2~2) made to `AddObjectEntries`.

Fixes: #26642
2025-01-28 10:01:00 -05:00
Robert Maynard 52d1b4ad05 CompilerId: Console error output has first try last
This ensures that a user after providing custom flags
will first see that attempt. Previously the compiler attempt with the user flags could have been lost due to
console log buffer / scrolling support
2025-01-03 11:27:26 -05:00
Robert Maynard 9510820d58 Help: Document CTest module BUILD_TESTING variable
The `BUILD_TESTING` variable is referenced in `add_test` and
`enable_testing`.  It should be documented as it controls the
behavior tests working when projects use `include(CTest)`.
2024-10-24 11:46:37 -04:00
Robert Maynard 0c1d290090 Tests: Ensure CUDA bin2c output is null terminated
The default behavior of bin2c is to create binary arrays that have no
null termination.  So to use it as a C array we need to explicitly tell
it to create valid null terminated strings.

This will safely allow us to run PTX tests across all CUDA drivers.
2024-10-18 11:05:10 -04:00
Robert Maynard ee9e2216ec Tests: Simplify CUDA kernels avoid crash with nvidia driver 550
Avoid having two identical kernels in PTX.  We don't need a second
kernel anyway.
2024-10-17 20:18:24 -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
Robert Maynard c75e873564 CUDA: OptiXIR test includes all required headers 2024-10-07 10:23:42 -04:00
Robert Maynard c1ece78d11 project: non cache <project> prefix variables are also created
Fixes #26243, #25714
2024-08-27 12:37:07 -04:00
Robert Maynard b90ae10dda Add support for unity builds with CUDA sources
Fixes #22750
2024-08-02 13:35:53 -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
Robert Maynard c99ff40b21 Unity: refactor unity extension logic to single function 2024-07-16 09:39:19 -04:00
Robert Maynard 8f974011ea FindCUDAToolkit: Allow new search locations after failure
Fixes #22010
2024-07-10 09:44:57 -04:00
Robert Maynard 2fc9e482a9 Evaluation of TRANSITIVE_LINK_PROPERTIES isn't considered a usage
Fixes #26108
2024-07-05 13:16:47 -04:00
Robert Maynard 8ba3441bd2 FindMPI include parsing better handles leading newlines
When FindMPI parses include output like:
```
 warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 -I....
 ```
2024-07-01 11:47:00 -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
Robert Maynard d47c5e3358 FindCUDAToolkit: Remove unneeded dependencies on the cuda driver
The nvrtc-builtins and nvptxcompiler projects don't required linking
to the cuda driver. We previously did this due to reading the
upstream documentation incorrectly.
2024-03-11 15:51:11 -04:00
Robert Maynard d420ee6b43 FindCUDAToolkit: Add support for nvfatbin added in 12.4 2024-03-05 16:43:09 -05:00
Robert Maynard af293ff7c3 Help: Explicitly discourage absolute install destinations
Document some of the problems caused by absolute install destinations.
Encourage use of relative paths.
2024-02-16 09:53:55 -05:00
Robert Maynard 879690ba14 GeneratorExpression: Add $<QUOTE> generator expression
Support inserting '"' literals in generator expressions

Fixes #20869
2024-02-14 14:23:18 -05:00
Robert Maynard 17d758b36d FindCUDAToolkit: Fix cuda driver dependencies
Fixes: #25665
2024-02-12 13:29:41 -05:00
Robert Maynard 4a3cafec4f FindCUDAToolkit: Fix cudart dependencies
Fixes: #25665
2024-02-08 12:57:13 -05:00
Robert Maynard 0cfd8fe8ad cmTarget: Don't allow setting read-only properties
Ensure that all documented read-only target properties now produce
errors when trying to set.
2024-01-23 08:50:38 -05:00
Robert Maynard 63e20653f8 add_test: Fix version of CMake introducing CMP0158 (to 3.29)
This was missed in commit ca5a300d7f (add_test: Honor
CROSSCOMPILING_EMULATOR only when cross-compiling, 2023-11-02) when it
slipped from the 3.28 release.
2024-01-05 17:01:01 -05:00
Robert Maynard 9d13674337 cmake-gui: Hint that the preset compilers will be used
Instead of stating that the default is the native compilers,
say we will use the compilers from the preset. This makes it
more clear that the preset is working as expected.
2024-01-05 12:04:12 -05:00
Robert Maynard 370370364b cmake-gui: Add support for preset toolchain entry
Previously the toolchain field was ignored when passing a preset
to cmake-gui.

Fixes: #24034
2024-01-05 12:01:44 -05:00
Robert Maynard d20c21a678 ccmake: Now supports the preset toolchain entry
Previously the toolchain field was ignored when passing a preset
to ccmake.
2024-01-03 14:46:33 -05:00
Robert Maynard 04959e0285 Tests: Verify CUDA::cupti existence on a subset of machines
When we know that the cupti library exists explicitly request the CUDA Toolkit test to verify the existence
2023-12-14 14:05:28 -05:00
Robert Maynard 09a3c8b46b CUDAToolkit: Correctly search all include paths from compiler
The CUDAToolkit usage of `find_path( PATHS )` was incorrectly
quoting a list of paths causing none of them to be used.
2023-12-14 14:04:53 -05:00
Robert Maynard f69b9b7305 CUDAToolkit: Restore ability to find cupti headers
Fixes #25484

PR !8835 failed to update the CUPTI header searches to use the
new internal FindCUDAToolkit search variables. This caused the
CUDA::cupti target to always not exist.
2023-12-08 11:46:54 -05:00
Robert Maynard b38a8e77cb FindCUDAToolkit: Search for cufile library name being lowercase
Fixes #25398
2023-11-08 10:43:30 -05:00
Robert Maynard d7642a7d42 CUDA: Support CMAKE_TRY_COMPILE_TARGET_TYPE of STATIC_LIBRARY 2023-11-07 10:48:32 -05:00
Robert Maynard 0b6ae9c467 FindCUDAToolkit: Restore CUDAToolkit_LIBRARY_SEARCH_DIRS variable
This was accidentally dropped by commit 4316d4dcfd (FindCUDAToolkit:
Search all of `nvcc` implicit includes and library dirs, 2023-09-26).
2023-10-04 12:10:02 -04:00
Robert Maynard 4316d4dcfd FindCUDAToolkit: Search all of nvcc implicit includes and library dirs
Improves the handling of CUDA layouts where we have multiple include
and library directories listed in the output of `nvcc -v`. This
updates both when the CUDA language is enabled or not.

Fixes: #24915
2023-09-27 13:28:52 -04:00
Robert Maynard cd984261e1 CUDA: Device linking now uses TARGET_OBJECTS content
Due to an oversight in cmLinkLineDeviceComputer object
files did not get propagate to the device linking phase
when given via the `$<TARGET_OBJECTS>` generator expression.
2023-09-25 08:50:38 -04:00
Robert Maynard aa8facefe8 CUDA: Visual Studio propagate objects to device linking
When given objects via `target_link_libraries(consumer PRIVATE producer)` the VisualStudio solution adds the objects
under as `<Object>` entries in the solution.

This works for host side linking but isn't handled by
the cuda msbuild extensions. So to work around this we
manually add the objects as additional link items.
2023-09-22 11:54:12 -04:00
Robert Maynard 6ebff6ebf8 VS: Avoid unnecessary CUDA device linking for OBJECT libraries
Without `CudaLink` fields, MSBuild tries to perform a device link step
for object libraries with CUDA_SEPARABLE_COMPILATION on them even when
not needed.  This commonly was encountered when generating PTX or
OPTIX-IR output.
2023-09-11 16:49:35 -04:00
Robert Maynard c85fd9a705 file: Clarify CMake only drops RPATHS's it added 2023-08-15 14:59:14 -04:00