For background, a bunch of projects help writing portable C++ code that can
be compiled into CUDA device code as one option, e.g. hemi, kokkos, RAJA (
https://devblogs.nvidia.com/simple-portable-parallel-c-hemi-2/). As a
consequence, if available those source files need to be compiled with the
CUDA compiler, but with the regular C++ compiler otherwise.

I'm wondering whether there is a clean way to support this in a cmake
build. Renaming my source files to `.cu` is bad if I'm on the system
without CUDA. I figured out that I can set the LANGUAGE property on a given
.cpp/.cxx source file to CUDA to have it compiled with CMAKE_CUDA_COMPILER,
but that's quite a hassle to do for every source file. Kokkos instead
creates a `nvcc_wrapper` script which one is supposed to use as
CMAKE_CXX_COMPILER, but that definitely seems like a kludge to me (and
giving me troubles).

Things would probably be much better for me if there was a way to change
the default language for .cxx / .cpp extensions. Is there a way to do this?

--Kai
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to