[CMake] how do you allow CMAKE_CUDA_COMPILER to be optional via project LANGUAGE?

Quang Ha quang.t.ha.20 at gmail.com
Tue Aug 28 13:06:58 EDT 2018


Hi all,

So this question is again about project(foo LANGUAGES CXX CUDA). Is it
possible to switch off CUDA if Cmake couldn't find CUDA compiler? I.e.
something along the line:

if (CUDA_FOUND)
  set_language_to_CUDA_and_CXX
else(CUDA_FOUND)
  set_language_to_CXX_only
endif(CUDA_FOUND)

The main reason is I don't want CMake to fail when CUDA compiler isn't
available. Rather, it should continue to compile the source files using CPP
compilers instead.

Thanks,
Quang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180828/9b54983c/attachment.html>


More information about the CMake mailing list