diff options
Diffstat (limited to 'cmake/modules/generate_crypto_test_wrapper.cmake')
-rw-r--r-- | cmake/modules/generate_crypto_test_wrapper.cmake | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/cmake/modules/generate_crypto_test_wrapper.cmake b/cmake/modules/generate_crypto_test_wrapper.cmake new file mode 100644 index 00000000..e1412f37 --- /dev/null +++ b/cmake/modules/generate_crypto_test_wrapper.cmake | |||
@@ -0,0 +1,45 @@ | |||
1 | # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> | ||
2 | # Copyright (c) 2013, Sandro Knauß <mail@sandroknauss.de> | ||
3 | # | ||
4 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
5 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
6 | |||
7 | |||
8 | if (UNIX) | ||
9 | |||
10 | file(WRITE "${_filename}" | ||
11 | "#!/bin/sh | ||
12 | # created by cmake, don't edit, changes will be lost | ||
13 | |||
14 | # don't mess with a gpg-agent already running on the system | ||
15 | unset GPG_AGENT_INFO | ||
16 | |||
17 | ${_library_path_variable}=${_ld_library_path}\${${_library_path_variable}:+:\$${_library_path_variable}} GNUPGHOME=${_gnupghome} gpg-agent --daemon \"${_executable}\" \"$@\" | ||
18 | _result=$? | ||
19 | _pid=`echo GETINFO pid | GNUPGHOME=${_gnupghome} gpg-connect-agent | grep 'D' | cut -d' ' -f2` | ||
20 | if [ ! -z \"\$_pid\" ]; then | ||
21 | echo \"Waiting for gpg-agent to terminate (PID: $_pid)...\" | ||
22 | while kill -0 \"\$_pid\"; do | ||
23 | sleep 1 | ||
24 | done | ||
25 | fi | ||
26 | exit \$_result | ||
27 | ") | ||
28 | |||
29 | # make it executable | ||
30 | # since this is only executed on UNIX, it is safe to call chmod | ||
31 | exec_program(chmod ARGS ug+x \"${_filename}\" OUTPUT_VARIABLE _dummy ) | ||
32 | |||
33 | else (UNIX) | ||
34 | |||
35 | file(TO_NATIVE_PATH "${_ld_library_path}" win_path) | ||
36 | file(TO_NATIVE_PATH "${_gnupghome}" win_gnupghome) | ||
37 | |||
38 | file(WRITE "${_filename}" | ||
39 | " | ||
40 | set PATH=${win_path};$ENV{PATH} | ||
41 | set GNUPGHOME=${win_gnupghome};$ENV{GNUPGHOME} | ||
42 | gpg-agent --daemon \"${_executable}\" %* | ||
43 | ") | ||
44 | |||
45 | endif (UNIX) | ||