The ShardingConnectionHook is only necessary for the mongod, mongos and dbtest executables and it depends on a lot of other libraries, so no need to link it into tests.