Export fixes

This pull request removes the previous export functionality that was obsoleted by the last pull request.

It also introduces the new CMake option `FIND_SHARED_LIBS` which controls if shared or static versions of third-party libraries (e.g., HDF5) are to be searched for. This revealed a bug in static build; I'll look at it.