Fixed the setting of CVAPI_EXPORTS for modules that are always static/shared.

Also, removed needless check of BUILD_SHARED_LIBS in core; in that case,
only the current module's library type matters.
Merge pull request #1193 from SpecLad:exports-for-contrarians