I had done the exact same thing and added the workaround to the Jenkins setup preamble. This is the verbose output of what actually gets called:
/usr/bin/c++ -pthread -O2 -g -L/tmp/install_dir/stack_overlay/unique_identifier/unique_id/lib CMakeFiles/test_unique_id.dir/tests/test_unique_id.cpp.o -o ../bin/test_unique_id -rdynamic -L/opt/ros/groovy/lib -lroscpp -lboost_signals-mt -lboost_filesystem-mt -lrosconsole -lroscpp_serialization -lxmlrpcpp -lrostime -lboost_date_time-mt -lboost_system-mt -lboost_thread-mt -lpthread -lcpp_common -l/usr/lib/libgtest.a -Wl,-rpath,/opt/ros/groovy/lib
/usr/bin/ld: cannot find -l/usr/lib/libgtest.a
So somewhere rosmake is using "-l/usr/lib/libgtest.a" instead of "-L /usr/lib -lgtest". Any suggestions from a rosmake guru?
Wim