This PR is an alternative to #1230.
Benefits of this PR in comparison to #1230:
- keeps ability to build a shared library and a static one simultaneously, which is convenient, for example, during a process of creating a distributable package like
libsecp256k1-dev
using CPack tool - has smaller diff
- does not require CMake version bumping
Now, a user can set PIC/non-PIC mode for a static library using CMAKE_POSITION_INDEPENDENT_CODE
, and this setting is independent from a shared library.