Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -868,14 +868,16 @@ endif() if( LLVM_INCLUDE_TESTS ) + include(LLVMExternalProjectUtils) + if(EXISTS ${LLVM_MAIN_SRC_DIR}/projects/test-suite AND TARGET clang) - include(LLVMExternalProjectUtils) - llvm_ExternalProject_Add(test-suite ${LLVM_MAIN_SRC_DIR}/projects/test-suite - USE_TOOLCHAIN - EXCLUDE_FROM_ALL - NO_INSTALL - ALWAYS_CLEAN) + llvm_ExternalProject_AddTestSuite(test-suite ${LLVM_MAIN_SRC_DIR}/projects/test-suite) + endif() + + if(EXISTS ${LLVM_MAIN_SRC_DIR}/projects/avr-metal AND ${LLVM_TARGETS_TO_BUILD} MATCHES "AVR") + llvm_ExternalProject_AddTestSuite(avr-metal ${LLVM_MAIN_SRC_DIR}/projects/avr-metal) endif() + add_subdirectory(test) add_subdirectory(unittests) if (MSVC) Index: cmake/modules/LLVMExternalProjectUtils.cmake =================================================================== --- cmake/modules/LLVMExternalProjectUtils.cmake +++ cmake/modules/LLVMExternalProjectUtils.cmake @@ -204,3 +204,10 @@ USES_TERMINAL) endforeach() endfunction() + +# Adds an external project which has nothing to install and +# is not built by default. +function(llvm_ExternalProject_AddTestSuite name source_dir) + llvm_ExternalProject_Add(${name} ${source_dir} + USE_TOOLCHAIN EXCLUDE_FROM_ALL NO_INSTALL ALWAYS_CLEAN) +endfunction()