Compiling and linking Google Tests from command line
Some homework for me on how best to incorporate Google Tests to unit test my own libraries without bringing in the whole JVM as a dependency.
The main thing is to incorporate my build framework to build the gtest
libraries, to link my code, the unit tests code, and the library together.
The raw, rudimentary command line to do so with the samples given is as such:
g++ -Wl,-rpath=\$ORIGIN -Iinclude -L. -lgtest -lgtest_main \
samples/sample1.cc \
samples/sample1_unittest.cc
The gtest_main
provides the main()
function, and gtest
provides the
test routines.