forked from BlockstreamResearch/secp256k1-zkp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake, refactor: Use helper function instead of interface library
This change aims to simplify the following commit.
- Loading branch information
Showing
1 changed file
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
add_library(example INTERFACE) | ||
target_include_directories(example INTERFACE | ||
${PROJECT_SOURCE_DIR}/include | ||
) | ||
target_link_libraries(example INTERFACE | ||
secp256k1 | ||
$<$<PLATFORM_ID:Windows>:bcrypt> | ||
) | ||
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_executable(ecdsa_example ecdsa.c) | ||
target_link_libraries(ecdsa_example example) | ||
add_test(NAME ecdsa_example COMMAND ecdsa_example) | ||
add_example(ecdsa) | ||
|
||
if(SECP256K1_ENABLE_MODULE_ECDH) | ||
add_executable(ecdh_example ecdh.c) | ||
target_link_libraries(ecdh_example example) | ||
add_test(NAME ecdh_example COMMAND ecdh_example) | ||
add_example(ecdh) | ||
endif() | ||
|
||
if(SECP256K1_ENABLE_MODULE_SCHNORRSIG) | ||
add_executable(schnorr_example schnorr.c) | ||
target_link_libraries(schnorr_example example) | ||
add_test(NAME schnorr_example COMMAND schnorr_example) | ||
add_example(schnorr) | ||
endif() |