Fix make distcheck failure from missing libgtest_main.la (#781978)
Running 'make distcheck' fails like this: [...] make[3]: Entering directory `[...]/gparted/gparted-0.28.1-git/_build/tests' [...] /bin/sh ../libtool --tag=CXX --mode=link g++ [...] ../../lib/gtest/lib/libgtest_main.la ../../lib/gtest/lib/libgtest.la [...] libtool: link: cannot find the library `../../lib/gtest/lib/libgtest_main.la' or unhandled argument `../../lib/gtest/lib/libgtest_main.la' make[3]: *** [test_dummy] Error 1 make[3]: Leaving directory `[...]/gparted/gparted-0.28.1-git/_build/tests' [...] make[1]: Leaving directory `[...]/gparted/gparted-0.28.1-git/_build' make: *** [distcheck] Error 1 What is happening is that distcheck [1] performs a VPATH build which uses separate read-only source and read-write build trees. Shipped source files, such as .h and .cc, are located in the source tree and the built files, such as .o and .la, are compiled into the build tree. In this case the absolute path to libgtest_main.la is specified using $(top_srcdir) for the source tree, rather than $(top_builddir) for the build tree, hence the cannot find file type error. This error doesn't occur when just performing a 'make check' because that builds in the source tree so $(top_builddir) is the same as $(top_srcdir). Fix by correctly specifying the absolute path to the libgtest*.la files using $(top_builddir). [1] Automake Manual, 14.4 Checking the Distribution https://www.gnu.org/software/automake/manual/automake.html#Checking-the-Distribution Note that for VPATH builds the Automake Manual [2] also recommends using a pair of -I options to specify header files are found in both the build and source trees, something like: AM_CPPFLAGS = -I$(top_builddir)/some/subdir -I$(top_srcdir)/some/subdir This is unnecessary for GParted as all header files are shipped as part of the source archive and no header files are created as part of the build process. Therefore adding -I options specifying $(top_builddir) include directories would just be specifying empty or non-existent include directories in the build tree. [2] Automake Manual, 8.7 Variables used when building a program https://www.gnu.org/software/automake/manual/automake.html#Program-Variables Bug 781978 - Add Google Test C++ test framework
This commit is contained in:
parent
dceb293f15
commit
dbd5cd2ca8
|
@ -5,9 +5,9 @@ AM_CPPFLAGS = \
|
|||
AM_CXXFLAGS = -Wall $(GTEST_CXXFLAGS)
|
||||
AM_LDFLAGS = $(GTEST_LDFLAGS)
|
||||
LDADD = \
|
||||
$(GTEST_LIBS) \
|
||||
$(top_srcdir)/lib/gtest/lib/libgtest_main.la \
|
||||
$(top_srcdir)/lib/gtest/lib/libgtest.la
|
||||
$(GTEST_LIBS) \
|
||||
$(top_builddir)/lib/gtest/lib/libgtest_main.la \
|
||||
$(top_builddir)/lib/gtest/lib/libgtest.la
|
||||
|
||||
# Programs to be built by "make check"
|
||||
check_PROGRAMS = \
|
||||
|
|
Loading…
Reference in New Issue