<div dir="ltr">Hello,<div><br></div><div>I'm attempting to implement link-time dependency injection. In brief, what this means is that, for a library A that depends on B, we would normally have:</div><div><br></div><div>  target_link_libraries(A B)</div><div><br></div><div>However, when building unittests for A (done in a subdirectory), we instead want:</div><div><br></div><div>  target_link_libraries(A MockB)</div><div><br></div><div>I've spent a bunch of time looking through CMake documentation and I'm not sure how to express this without resorting to manually specifying the link line when A is in use. Could someone give me some guidance?</div><div><br></div><div>Thanks!</div><div>Josh</div></div>