]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | # Copyright 2019 - 2021 Alexander Grund |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # (See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | if(NOT DEFINED TEST_BINARY) | |
6 | if(CMAKE_ARGC GREATER 3) | |
7 | # cmake(0) -P(1) <script>(2) <first arg>(3) | |
8 | set(TEST_BINARY ${CMAKE_ARGV3}) | |
9 | else() | |
10 | message(FATAL_ERROR "You need to define TEST_BINARY with the path to the binary") | |
11 | endif() | |
12 | endif() | |
13 | ||
14 | set(msg "Hello Boost Nowide") | |
15 | ||
16 | execute_process( | |
17 | COMMAND ${CMAKE_COMMAND} -E echo "${msg}" # This will be stdin of the below cmd | |
18 | COMMAND "${TEST_BINARY}" passthrough | |
19 | RESULT_VARIABLE result | |
20 | OUTPUT_VARIABLE stdout | |
21 | ) | |
22 | if(NOT result EQUAL 0) | |
23 | message(FATAL_ERROR "Command ${TEST_BINARY} failed (${result}) with ${stdout}") | |
24 | endif() | |
25 | if(NOT stdout MATCHES ".*${msg}") | |
26 | message(FATAL_ERROR "Command ${TEST_BINARY} did not output '${msg}' but '${stdout}'") | |
27 | endif() | |
28 | message(STATUS "Test OK") |