[GNC-dev] Gnucash-3.0 build error: GTEST not found

DaveC49 davidcousens at bigpond.com
Sun Apr 8 02:12:25 EDT 2018


I am past the initial problem but I appear to be having a problem with GTEST
not being found. I have gtest 1.8.0 intsalled  and I have also uninstalled
it and reinstalled 1.7.0 from the ubuntu repository with the same result:
$ cmake -D CMAKE_INSTALL_PREFIX=/usr/local/gnucash -D WITH_AQBANKING=OFF ../
-- Using guile-2.0.x
-- Using guile SRFI-64
-- Checking for GTEST
CMake Error at common/cmake_modules/GncAddTest.cmake:145 (MESSAGE):
  GTEST not found.  Please install it or set GTEST_ROOT or GMOCK_ROOT
Call Stack (most recent call first):
  CMakeLists.txt:596 (GNC_GTEST_CONFIGURE)

-- Configuring incomplete, errors occurred!
See also
See also

I am using build-cmake under the gnucash-3.0 directory.  I have
GTEST_ROOT="/usr/local" and GMOCK_ROOT="/usr/local".  The gtest and gmock
files are installed as follows:
/usr/local/include/gtest/gtest.h  and other gtest includes'
/usr/local/include/gmock/gmock.h and other gmock includes

I have also built and had the 

files installed without any success.

The  /usr/src contains these files which are from the distros v 1.7.0

I opened GncAddTest.cmake which fails at line 145 and looked at the

The FIND_PATH(GTEST_INCLUDE_DIR gtest/gtest.h  should  find gtest.h in
/usr/local/include/gtest/gtest.h using the PATH ${GTEST_ROOT}/include =>

FIND_PATH(GTEST_SRC_DIR src/gtest_all.cc  should find gtest_all.cc in 
/usr/src/gtest/src/gtest-all.cc using the PATH using the PATH /usr/src/gtest
even though these are the v1.7.0 files found. => GTEST_SRC_DIR is TRUE

FIND_LIBRARY(GTEST_SHARED_LIB gtest)  I am not sure whether this will or
will not find /usr/local/lib/libgtest.a

and whether FIND_LIBRARY(GTEST_MAIN_LIB gtest_main) is finding

The Documentation for the CMake FIND_LIBRARY function indicates that the
name supplied as the argument is what the function searches for. From what 
can understand it will search paths specified in the 
PATH and LIB environment variables.
These are respectively:
$ echo $PATH
$ echo $LIB

but the same error still occurs.  My conclusion is that the
GNC_GTEST_CONFIGURE should be searching for libgtest rather than gtest or
perhaps for both if some installations name the library gtest rather than

If anyone has any insights or suggestions please let me know. My next step
is to generate a test Cmake setup to experiment with the FIND_LIBRARY
function and also test the other searches done. This may take me a while
since I am still getting to grips with CMake. The Cmake output and error
files are attached if anyone can make more sense of them than I can
<http://gnucash.1415818.n4.nabble.com/file/t375329/CMakeOutput.log>   .

Thanks in advance


David Cousens
Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-Dev-f1435356.html

More information about the gnucash-devel mailing list