Skip to content

Commit

Permalink
cmake: Set ENVIRONMENT property for examples on Windows
Browse files Browse the repository at this point in the history
This change simplifies running examples on Windows, because the DLL
must reside either in the same folder where the executable is or
somewhere in PATH.
  • Loading branch information
hebasto committed Jul 14, 2023
1 parent cef3739 commit 116d2ab
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ function(add_example name)
)
set(test_name ${name}_example)
add_test(NAME ${test_name} COMMAND ${target_name})
if(BUILD_SHARED_LIBS AND MSVC)
# The DLL must reside either in the same folder where the executable is
# or somewhere in PATH. Using the latter option.
set_tests_properties(${test_name} PROPERTIES
ENVIRONMENT "PATH=$<TARGET_FILE_DIR:secp256k1>;$ENV{PATH}"
)
endif()
endfunction()

add_example(ecdsa)
Expand Down

0 comments on commit 116d2ab

Please sign in to comment.