Fetching googlemock
Konrad Zemek
konrad.zemek at gmail.com
Sat Dec 13 16:14:51 UTC 2014
Hey everyone,
gmock sources are still not packaged by distributions, and compiling
Amarok with tests on is still troublesome (I still use a cmake-gui
based approach where I manually set paths to my pre-compiled gmock
lib, as I outlined in an email some months ago).
I solved the problem through the use of submodules and commited the
change to my personal scratch repo [1]. The solution is as follows: I
created git mirrors of googlemock and googletest repositories [2][3]
(as the former requires the latter) and put them respectively under
tests/gmock and tests/gtest. I also modified tests' CMakeLists.txt to
automatically fetch the submodules when the build is configured, and
set up the build to use the fetched gmock sources.
There's no need to fetch the repos if Amarok is built without tests
and indeed, in that case they won't be fetched automatically either.
If user wants to build with tests, he can fetch the submodules himself
just after cloning Amarok repository (using `git submodule init; git
submodule update` commands), or we can fetch them for him during the
configuration step. When everything else fails, i.e. user didn't fetch
the submodules and we can't fetch them automatically, the build fails
with:
"CMake Error at tests/CMakeLists.txt:23 (message):
Cannot fetch googlemock submodule. Please fetch the submodule manually
using `git submodule update --init` in Amarok source directory or
reconfigure the project to compile without tests."
If you find my approach agreeable, I will be happy to put it on reviewboard.
By the way, I noticed that importer tests are now guarded with
'if(LINUX)' macro. There is no 'LINUX' platform in CMake, though, so
these tests are effectively disabled everywhere. I guess there were
some problems on non-linux systems?
Konrad
[1] http://commits.kde.org/clones/amarok/kzemek/amarok/8ea551198edf1ba2853d94763cc4fd9207f9bc9b
[2] https://github.com/kzemek/googlemock
[3] https://github.com/kzemek/googletest
More information about the Amarok-devel
mailing list