]> rtime.felk.cvut.cz Git - coffee/buildroot.git/commitdiff
gtest: fix usage on ARM platforms
authorCarlos Santos <casantos@datacom.ind.br>
Wed, 19 Apr 2017 11:51:52 +0000 (08:51 -0300)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 20 Apr 2017 20:31:53 +0000 (22:31 +0200)
Ensure that GTest is compiled with -fPIC to allow linking the static
libraries with dynamically linked programs. This is not a requirement
for most architectures but is mandatory for ARM.

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/gtest/gtest.mk

index 9e6914109af4cc8e92005d1095eb47edb34c8ce7..337a168dfb11addfce7f1a416bf617cb783bf935 100644 (file)
@@ -37,6 +37,13 @@ HOST_GTEST_GMOCK_PYTHONPATH = \
 # the gtest sources.
 GTEST_CONF_OPTS = -DBUILD_SHARED_LIBS=OFF
 
+# Ensure that GTest is compiled with -fPIC to allow linking the static
+# libraries with dynamically linked programs. This is not a requirement
+# for most architectures but is mandatory for ARM.
+ifeq ($(BR2_STATIC_LIBS),)
+GTEST_CONF_OPTS += -DCMAKE_POSITION_INDEPENDENT_CODE=ON
+endif
+
 GTEST_CONF_OPTS += -DBUILD_GTEST=ON
 
 ifeq ($(BR2_PACKAGE_GTEST_GMOCK),y)