This version of NVidia drivers is required for some slightly older graphics cards (as e. g. in this notebook). It does not compile with >linux-4 and most propably not with linux-3.19.*. It does compile with 3.18, however and works well.
kernel driver packages can't depend on specific sources.
nvidia drivers depend on virtual/linux-source. Why can't specific versions depend on specific (i. e. supported) kernel sources? They do depend on a specific xorg-xserver, pretty much for the same reason.
(In reply to Thomas from comment #2)
> nvidia drivers depend on virtual/linux-source. Why can't specific versions
> depend on specific (i. e. supported) kernel sources? They do depend on a
> specific xorg-xserver, pretty much for the same reason.
Because you could have twenty /usr/src/linux-* and the nvidia-drivers ebuild has no way to influence which it will build against.
Also, I don't see why you're stuck on 340.* - you should be able to use 343 or 346 - the latter supports up to kernel 4.1.
Also, please use https://forums.gentoo.org/ for general enquiries.
Officially supported kernels are gentoo-sources and vanilla-sources. (But probably, people sucessfully use the drivers with other source flavours, too.)
Support for GeForce 200 series was dropped after 340.*, that is why we are stuck with this version. Cf. bug 549714.
Of cource you cannot fix that the 340.* drivers don't compile against recent kernels, but the original request was to make the drivers depend on kernels the drivers compile against.