The source package is setup for both DNN4 and DNN5 compilation in a single package to make it easier for us to develop for both. We use a Custom constant named DNNVERSION that can be set to either DNN4 or DNN5 depending on which DNN version we're targeting. In the project settings, under compile and then Advanced Compiler Settings you'll see the Custom constants definition.
It will look something like this: DNNVERSION="DNN5"
Just change this to the general DNN version number you are targeting.
You may also need to change the DNN Assembly reference to point to your specific dotnetnuke.dll as well.