c232486d84Revert "cmake: Set `ENVIRONMENT` property for examples on Windows" (Hennadii Stepanov)26e4a7c214cmake: Set top-level target output locations (Hennadii Stepanov) Pull request description: While testing https://github.com/bitcoin-core/secp256k1/pull/1551, I noticed that when cross-compiling a shared library with examples for Windows, the `ctest` fails to run examples with Wine. Adjusting the `PATH` variable in4af241b320/examples/CMakeLists.txt (L16-L18)does not help because `WINEPATH` is expected. Another issue with the current implementation is that the examples cannot run individually on Windows. This PR resolves both issues by reverting the implementation from https://github.com/bitcoin-core/secp256k1/pull/1290 in favour of the reworked and improved implementation from https://github.com/bitcoin-core/secp256k1/pull/1233. ACKs for top commit: theuni: Concept ACK and utACKc232486d84. real-or-random: utACKc232486d84Tree-SHA512: 479b71d15d5d5670f6f69da3da599240c345711003383ca805c821b67065c9baaf269f987792cf1029211cdbfe799aecd401e6940a471539e3929b4a90e0781d
32 lines
676 B
CMake
32 lines
676 B
CMake
function(add_example name)
|
|
set(target_name ${name}_example)
|
|
add_executable(${target_name} ${name}.c)
|
|
target_include_directories(${target_name} PRIVATE
|
|
${PROJECT_SOURCE_DIR}/include
|
|
)
|
|
target_link_libraries(${target_name}
|
|
secp256k1
|
|
$<$<PLATFORM_ID:Windows>:bcrypt>
|
|
)
|
|
set(test_name ${name}_example)
|
|
add_test(NAME ${test_name} COMMAND ${target_name})
|
|
endfunction()
|
|
|
|
add_example(ecdsa)
|
|
|
|
if(SECP256K1_ENABLE_MODULE_ECDH)
|
|
add_example(ecdh)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG)
|
|
add_example(schnorr)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_ELLSWIFT)
|
|
add_example(ellswift)
|
|
endif()
|
|
|
|
if(SECP256K1_ENABLE_MODULE_MUSIG)
|
|
add_example(musig)
|
|
endif()
|