This paper is devoted to the study of consensus problem of multi-agent systems with a time-varying reference state in directed networks with both switching topology and time-delay. Stability analysis is performed based on a proposed Lyapunov–Krasovskii function. Sufficient conditions based on linear matrix inequalities (LMIs) are given to guarantee that multi-agent consensus on a time-varying reference state can be achieved under arbitrary switching of the network topology even if the network communication is affected by time-delay. These consensus algorithms are also extended to consensus formation among the agents. Finally, simulation example is given to validate our theoretical results.