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.