On Wed, Sep 5, 2012 at 6:45 AM, Josh Glover <jmg...@gmail.com> wrote:
>> Others should be able to set GTEST_DIR and GMOCK_DIR >> environment variables to an unzipped gtest/gmock source tree and get >> it working as well (untested). > > Great idea, Kai! I'll give it a try as soon as I have a minute or two > in front of a real computer. ;) Beware, it's only done for the autotools build at present. But if it works out, I can also adapt it for CMake. I didn't really want to look into that, but in order to run my new unit test, I had to do something. Compiling from source with your patches gets cumbersome if you can just do apt-get install libgtest-dev instead. The problem was, no precompiled library is included, just the source and headers. Looking how other projects handled the issue, I came across this http://www.mail-archive.com/aptitude-devel@lists.alioth.debian.org/msg00774.html It turned out however, that there is a difference between Debian and Ubuntu in how gmock is handled. On Debian it also comes as source code only, it seems, while on Ubuntu it is precompiled. So I have adapted our build to search for an existing lib first, then fall back to the code, searching in the default location or user-specified path. There are two possible errors that I can think of right now. When using an external gtest and gmock source, meaning the headers are not present in /usr/include, it might not be able to find them in case I have gotten the include directive wrong. See https://github.com/ksterker/adonthell/blob/master/configure.in#L353 https://github.com/ksterker/adonthell/blob/master/configure.in#L365 Second, if both gtest and gmock are present in source form, the Makefile might break because it contains two noinst_LIBRARIES directives. Not sure if that is supported by automake. See https://github.com/ksterker/adonthell/blob/master/src/Makefile.am#L18 https://github.com/ksterker/adonthell/blob/master/src/Makefile.am#L26 Other than that, I am not quite certain if adonthell/src is the proper place to build those libs. The problem is that they need to be built before anything else, since if you run "make check", it immediately wants to build and execute the unit tests of each module (after building the module). So the only other likely place to do it would be in adonthell/src/base or perhaps a new adonthel/src/test directory. In which case, the linker flags need to be changed to point to that place instead. See https://github.com/ksterker/adonthell/blob/master/configure.in#L354 https://github.com/ksterker/adonthell/blob/master/configure.in#L366 Also mind the single quotes in those two lines. We don't want to expand $top_builddir when configure runs, but rather in each of the Makefiles that use libgmock_LIBS. Cheers, Kai _______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/adonthell-devel