add_subdirectory(... EXCLUDE_FROM_ALL) should disable tests for the subdirectory
When a subdirectory is added with EXCLUDE_FROM_ALL, its targets are disabled, but its tests are not. The result is that the test executables aren't built, but testing still attempts to run them, which fails.
I think that it would be better for add_subdirectory(... EXCLUDE_FROM_ALL) to disable the tests as well. There is already precedent for this, as EXCLUDE_FROM_ALL does disable the install targets for the subdirectory.
A minimal example that demonstrates this is:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.5...3.16)
project(Main CXX)
include(CTest)
add_subdirectory(subdir EXCLUDE_FROM_ALL)
subdir/CMakeLists.txt:
cmake_minimum_required(VERSION 3.5...3.16)
project(Subdir CXX)
add_executable(main main.cpp)
add_test(main main)
subdir/main.cpp:
int main() {}