build: Introduce SECP256K1_STATIC macro for Windows users

It is a non-Libtool-specific way to explicitly specify the user's
intention to consume a static `libseck256k1`.

This change allows to get rid of MSVC linker warnings LNK4217 and
LNK4286. Also, it makes possible to merge the `SECP256K1_API` and
`SECP256K1_API_VAR` into one.
This commit is contained in:
Hennadii Stepanov
2023-06-30 09:26:48 +01:00
parent 7966aee31d
commit ae9db95cea
6 changed files with 11 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ endif()
# This matches libtool's usage of DLL_EXPORT
if(WIN32)
set_target_properties(secp256k1 PROPERTIES DEFINE_SYMBOL "DLL_EXPORT")
target_compile_definitions(secp256k1 INTERFACE $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:SECP256K1_STATIC>)
endif()
# Object libs don't know if they're being built for a shared or static lib.