Fix build with GMX_BUILD_UNITTESTS=OFF

Don't build the object libraries used for unit tests either if the unit
tests are disabled.  Added a helper macro for this as well.

Change-Id: I7b9f899dd2ee8adef261e49d3f8100530487ed54