Proper static lib packaging

Fixes #18574