diff --git a/CMakeLists.txt b/CMakeLists.txt index 57224532c16e5..08e25e8cedf59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -578,6 +578,9 @@ if(DEFINED ENV{LDFLAGS}) deduplicate_flags(CMAKE_EXE_LINKER_FLAGS) endif() +if(BUILD_TESTS) + enable_testing() +endif() set(CMAKE_SKIP_RPATH TRUE) add_subdirectory(test) add_subdirectory(doc) diff --git a/cmake/tests.cmake b/cmake/tests.cmake index 0abccf5999f1e..7f597262c82d0 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -2,8 +2,6 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit/. -include(CTest) - 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