How to build static libraries?

crosspost: Cannot build Opencv as static libraries - Stack Overflow