Skip to content
Snippets Groups Projects
Commit 2e98fc4e authored by Kevin Mittman's avatar Kevin Mittman
Browse files

Add two examples for CMake

parent 355e25cc
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required (VERSION 3.17)
project (HelloWorld)
set(CUDAToolkit_ROOT "${CMAKE_BINARY_DIR}/extracted/cuda")
find_package(CUDAToolkit)
# CMake example 1: FindCUDAToolkit
FindCUDAToolkit is the recommended module for importing CUDA components into the CMake build system (3.17 and newer).
The path to the extraction location can be specified with `-DCUDAToolkit_ROOT=$PWD/extracted` or the `CUDAToolkit_ROOT` environmental variable
> **NOTE:** The minimum required components for the FindCUDAToolkit module are `cuda_cudart` and `cuda_nvcc`.
## Commands
```shell
mkdir extracted
cd extracted
tar -xf cuda_nvcc-linux-x86_64-*-archive.tar.xz
tar -xf cuda_nvcc-linux-x86_64-*-archive.tar.xz
mkdir cuda
rsync -av *-archive/ cuda/
cd ..
cmake .
```
cmake_minimum_required (VERSION 3.17)
project (CUDA)
set(CUDAToolkit_ROOT "${CMAKE_BINARY_DIR}/extracted/cuda")
find_package(CUDAToolkit)
# CMake example 2: ExternalProject
The ExternalProject_Add module downloads archives from a URL
## Commands
```shell
cmake .
make
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment