I am adding optional CUDA functionalities to a CMake project. Right now, the project is organized as an executable and some static libraries. In the top level CMakeLists.txt file there is a project statement like this:
project (my_project LANGUAGES CXX)
And below there an option statement adds the parameter to regulate whether to build with the CUDA functionalities or not
option(CUDA_FEATS "Set to On to use CUDA features" ON)
I am not sure what the correct thing to do would be. Should I:
- Edit the top
projectstatement to add CUDA - Add, after the
CUDA_FEATSoption is set, a statement likeproject (my_project LANGUAGES CXX CUDA)(could this conflict with the initial one?) - Only put the
projectstatement after the parameter has been set
Or something else entirely? What is the best practice in these cases?