fix decl specs for static build

This uses the generate_export_header function introduced in CMake 2.8.6, simplifying the dll export/import/static build switch.

It's only tested on MSVC.