Enabling precise forecasting of the remaining useful life (RUL) for machines can reduce maintenance cost, increase availability and prevent catastrophic consequences. Data-driven RUL prediction methods have already achieved acclaimed performance. However, they usually assume that the training and testing data are collected from the same condition (same distribution or domain), which is generally not valid in real industry. Conventional approaches to address domain shift problems attempt to derive domain invariant features, but fail to consider target-specific information, leading to limited performance. To tackle this issue, we propose a contrastive adversarial domain adaptation (CADA) method for cross-domain RUL prediction. The proposed CADA approach is built upon an adversarial domain adaptation architecture with a contrastive loss, such that it is able to take target-specific information into consideration when learning domain invariant features. To validate the superiority of the proposed approach, comprehensive experiments have been conducted to predict the RULs of aero-engines across 12 cross-domain scenarios. The experimental results show that the proposed method significantly outperforms state-of-the-arts with over 21% and 38% improvements in terms of two different evaluation metrics.