Hi,
I use the latest options to integrate CUDA and CPP code in one library by setting enable_language(CUDA). In my project, I apply typical options supported by CMAKE such as POSITION_INDEPENDENT_CODE which is nicely integrated in CMAKE.
However, I also use some compiler specific flags such as “-Wno-psabi”. These flags are known by GCC but lead to an error message when invoking the NVCC.
My question: how am I suppose to provide flags for GCC which are not in use by the NVCC? It seems that NVCC is always using the same flags as specific in CMAKE_CXX_FLAGS.
In all “normal” cpp files, during compilation, that option is set. In the call to the “CUDA” compilation, however, the /wd4244 exression is ALSO added which then breaks the compilation command.
I had expected that /wd4244 is not added to NVCC command due to the generator expression.
Note that you can use $<$<COMPILE_LANGUAGE:C,CXX>:/wd4244> to simplify this. You may also want to consider possibly using $<COMPILE_LANG_AND_ID:C,MSVC> (this does not support multiple languages).