Skip to content

Commit a6df860

Browse files
committed
cmake: Set ENVIRONMENT property for examples on Windows
This change simplifies running examples on Windows, because the DLL must resides either in the same folder where the executable is or somewhere in PATH.
1 parent 73d5ad0 commit a6df860

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: examples/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ function(add_example name)
1717

1818
set(test_name ${name}_example)
1919
add_test(NAME ${test_name} COMMAND ${target_name})
20+
if(BUILD_SHARED_LIBS AND MSVC)
21+
# The DLL must resides either in the same folder where the executable is
22+
# or somewhere in PATH. Using the latter option.
23+
set_tests_properties(${test_name} PROPERTIES
24+
ENVIRONMENT "PATH=$<TARGET_FILE_DIR:secp256k1>;$ENV{PATH}"
25+
)
26+
endif()
2027
endfunction()
2128

2229
add_example(ecdsa)

0 commit comments

Comments
 (0)