5.4.4 : Le fichier CMakeLists.txt



Écrire le fichier CMakeLists.txt est assez simple :

On définit notre projet :
1
2
project(TestNvcppMultipleFile)
cmake_minimum_required(VERSION 3.0)


On ajoute quelques flags de compilation (le fameux -stdpar, une option d'optimisation basique, les warnings et l'activation de C++17) :
1
set(CMAKE_CXX_FLAGS "-stdpar=gpu -O1 -Wall -std=c++17")


On créé notre exécutable :
1
add_executable(test_nvcpp_multiple_file hadamard_product.cpp main.cpp)


Le fichier CMakeLists.txt complet :

1
2
3
4
project(TestNvcppMultipleFile)
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_FLAGS "-stdpar=gpu -O1 -Wall -std=c++17")
add_executable(test_nvcpp_multiple_file hadamard_product.cpp main.cpp)


Le fichier CMakeLists.txt est disponible ici.