File structure to satisfy both building and testing?

Yeah. But I argue that having to manually list unreferenced lib libraries under lib_ignore to get your tests to compile is not something we should settle for. It’s a band-aid that’s only needed because of the bug or strange design decision to have tests draw dependencies from src/main (even though that file has nothing to do with running tests).

…Unless I’m missing something, but my experiments showed it working like this (copied from above):

During testing, what gets compiled from lib/ is anything satisfying the logic below.

( [is listed under lib_deps] OR
  [is in the dependency tree of your test code] OR
  [is in the dependency tree of src/main.cpp]  <-- why?
) AND NOT [is listed under lib_ignore]