diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f6b0b51ce778..b54b97a2673d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,7 +314,13 @@ if(WERROR) endif() find_package(Python3 3.9 COMPONENTS Interpreter) -set(PYTHON_COMMAND ${Python3_EXECUTABLE}) +if(Python3_EXECUTABLE) + set(PYTHON_COMMAND ${Python3_EXECUTABLE}) +else() + list(APPEND configure_warnings + "Minimum required Python not found. Utils and rpcauth tests are disabled." + ) +endif() add_subdirectory(src) add_subdirectory(test) diff --git a/cmake/tests.cmake b/cmake/tests.cmake index 598af496387d2..ba73e7d32b4b8 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -1,18 +1,20 @@ -# Copyright (c) 2023 The Bitcoin Core developers +# Copyright (c) 2023-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# file COPYING or https://opensource.org/license/mit/. include(CTest) -if(TARGET bitcoin-util AND TARGET bitcoin-tx) +if(TARGET bitcoin-util AND TARGET bitcoin-tx AND PYTHON_COMMAND) add_test(NAME util_test_runner COMMAND ${CMAKE_COMMAND} -E env BITCOINUTIL=$ BITCOINTX=$ ${PYTHON_COMMAND} ${CMAKE_BINARY_DIR}/test/util/test_runner.py ) endif() -add_test(NAME util_rpcauth_test - COMMAND ${PYTHON_COMMAND} ${CMAKE_BINARY_DIR}/test/util/rpcauth-test.py -) +if(PYTHON_COMMAND) + add_test(NAME util_rpcauth_test + COMMAND ${PYTHON_COMMAND} ${CMAKE_BINARY_DIR}/test/util/rpcauth-test.py + ) +endif() if(TARGET bench_bitcoin) add_test(NAME bench_sanity_check_high_priority