Index: test/cfi/CMakeLists.txt =================================================================== --- test/cfi/CMakeLists.txt +++ test/cfi/CMakeLists.txt @@ -74,15 +74,17 @@ opt sanstats ) - if(LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR) - list(APPEND CFI_TEST_DEPS - LLVMgold - ) - endif() - if(APPLE) - list(APPEND CFI_TEST_DEPS - LTO - ) + if(LLVM_ENABLE_PIC) + if(LLVM_BINUTILS_INCDIR) + list(APPEND CFI_TEST_DEPS + LLVMgold + ) + endif() + if(APPLE) + list(APPEND CFI_TEST_DEPS + LTO + ) + endif() endif() if(NOT APPLE AND COMPILER_RT_HAS_LLD) list(APPEND CFI_TEST_DEPS Index: test/safestack/CMakeLists.txt =================================================================== --- test/safestack/CMakeLists.txt +++ test/safestack/CMakeLists.txt @@ -6,15 +6,17 @@ list(APPEND SAFESTACK_TEST_DEPS safestack) # Some tests require LTO, so add a dependency on the relevant LTO plugin. - if(LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR) - list(APPEND SAFESTACK_TEST_DEPS - LLVMgold - ) - endif() - if(APPLE) - list(APPEND SAFESTACK_TEST_DEPS - LTO - ) + if(LLVM_ENABLE_PIC) + if(LLVM_BINUTILS_INCDIR) + list(APPEND SAFESTACK_TEST_DEPS + LLVMgold + ) + endif() + if(APPLE) + list(APPEND SAFESTACK_TEST_DEPS + LTO + ) + endif() endif() endif()