Skip to content

Commit 116d2ab

Browse files
committed
cmake: Set ENVIRONMENT property for examples on Windows
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.
1 parent cef3739 commit 116d2ab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ function(add_example name)
1010
)
1111
set(test_name ${name}_example)
1212
add_test(NAME ${test_name} COMMAND ${target_name})
13+
if(BUILD_SHARED_LIBS AND MSVC)
14+
# The DLL must reside either in the same folder where the executable is
15+
# or somewhere in PATH. Using the latter option.
16+
set_tests_properties(${test_name} PROPERTIES
17+
ENVIRONMENT "PATH=$<TARGET_FILE_DIR:secp256k1>;$ENV{PATH}"
18+
)
19+
endif()
1320
endfunction()
1421

1522
add_example(ecdsa)

0 commit comments

Comments
 (0)