This PR:
-
Switches to a modern CMake approach by using the
Python3::Interpreter
imported target, which is more robust than using variables. -
Disables tests instead of ignoring them.
For example:
- building without Python available:
0$ cmake -B build
1$ cmake --build build -j 16
2$ # ctest --test-dir build -j 16 -R "^util_"
3Internal ctest changing into directory: /bitcoin/build
4Test project /bitcoin/build
5 Start 113: util_tests
6 Start 114: util_threadnames_tests
7 Start 112: util_string_tests
8 Start 1: util_test_runner
91/5 Test [#1](/bitcoin-bitcoin/1/): util_test_runner .................***Not Run (Disabled) 0.00 sec
10 Start 2: util_rpcauth_test
112/5 Test [#2](/bitcoin-bitcoin/2/): util_rpcauth_test ................***Not Run (Disabled) 0.00 sec
123/5 Test [#112](/bitcoin-bitcoin/112/): util_string_tests ................ Passed 0.01 sec
134/5 Test [#114](/bitcoin-bitcoin/114/): util_threadnames_tests ........... Passed 0.01 sec
145/5 Test [#113](/bitcoin-bitcoin/113/): util_tests ....................... Passed 0.13 sec
15
16100% tests passed, 0 tests failed out of 3
17
18Total Test time (real) = 0.13 sec
19
20The following tests did not run:
21 1 - util_test_runner (Disabled)
22 2 - util_rpcauth_test (Disabled)
- building without
bitcoin-tx
:
0$ cmake -B build -DBUILD_TX=OFF
1$ cmake --build build -j 16
2$ ctest --test-dir build -j 16 -R "^util_"
3Internal ctest changing into directory: /bitcoin/build
4Test project /bitcoin/build
5 Start 1: util_test_runner
61/5 Test [#1](/bitcoin-bitcoin/1/): util_test_runner .................***Not Run (Disabled) 0.00 sec
7 Start 2: util_rpcauth_test
8 Start 112: util_string_tests
9 Start 113: util_tests
10 Start 114: util_threadnames_tests
112/5 Test [#112](/bitcoin-bitcoin/112/): util_string_tests ................ Passed 0.01 sec
123/5 Test [#114](/bitcoin-bitcoin/114/): util_threadnames_tests ........... Passed 0.01 sec
134/5 Test [#2](/bitcoin-bitcoin/2/): util_rpcauth_test ................ Passed 0.06 sec
145/5 Test [#113](/bitcoin-bitcoin/113/): util_tests ....................... Passed 0.13 sec
15
16100% tests passed, 0 tests failed out of 4
17
18Total Test time (real) = 0.13 sec
19
20The following tests did not run:
21 1 - util_test_runner (Disabled)