Here is one way to make a unit test that needs most blender libraries in order to link.
The libraries needed were determined before in source/creator's CMakeLists.txt, and that was processed after the source directory (which includes tests) was processed, so was too late to set a variable that tests could see. One solution to that problem, used in this patch, is to move the libraries determination into a macro that the whole project can see, and call that macro twice, one in tests (if WITH_TESTS), and once in creator. Another solution would be to move the processing of tests after processing of creator, I suppose.
Another solution, debated in T40298: Design linking scheme to make gunit testing of non-standalone blender libraries sane, is to make all the libraries explicitly declare all of their direct dependencies. That could avoid the need for the manual maintenance of sorted libraries, and might result in somewhat fewer libraries being linked into tests.
This patch also includes a start at a bmesh_core_test. It tests BMVert creation.