conditional compilation for nvcc/c++ compiler

I’m having the problem that I want to define some device functions in a *.h that is visible to different source files that are compiled by nvcc and the regular c++ compiler. Some of the source will be pure c++ and the other, cuda.

The c++ compiler complains about the device functions since they are not c++. But on the other hand, there is no need for the c++ compiler to see these definitions. I was wondering if there is a standard macro that is #defined by nvcc but not passed onto the c++ compiler? That way I could surround such definitions in #ifdefs and keep all my related definitions well-organized. Is this possible?

CUDACC is the standard macro you’re looking for.