3.2.2 : Le CMakeLists.txt

Écrivons le CMakeLists.txt :

On commence le projet comme d'habitude
1
2
project(TestCudaCapabilities)
cmake_minimum_required(VERSION 3.0)


On demande d'avoir Cuda :
1
2
3
4
find_package(CUDA REQUIRED)

message(STATUS "Found headers CUDA : ${CUDA_INCLUDE_DIRS}")
message(STATUS "Found lib CUDA : ${CUDA_LIBRARIES}")


On ajoute les dossiers d'inclusion pour Cuda et nos sources :
1
2
3
4
include_directories(${CUDA_INCLUDE_DIRS})

cuda_add_executable("test_cuda_capabilities" main.cpp)
target_link_libraries(test_cuda_capabilities ${CUDA_LIBRARIES})


Le fichier CMakeLists.txt complet :

1
2
3
4
5
6
7
8
9
10
11
12
project(TestCudaCapabilities)
cmake_minimum_required(VERSION 3.0)

find_package(CUDA REQUIRED)

message(STATUS "Found headers CUDA : ${CUDA_INCLUDE_DIRS}")
message(STATUS "Found lib CUDA : ${CUDA_LIBRARIES}")

include_directories(${CUDA_INCLUDE_DIRS})

cuda_add_executable("test_cuda_capabilities" main.cpp)
target_link_libraries(test_cuda_capabilities ${CUDA_LIBRARIES})


Vous pouvez le télécharger ici.