Skip to content

Commit 3509866

Browse files
committed
Set CMAKE_POSITION_INDEPENDENT_CODE in tests
/usr/bin/ld: ../../../lib/libgtest.a(gtest-all.cc.o): warning: relocation against _ZTVN7testing8internal11MatcherBaseISt17basic_string_viewIcSt11char_traitsIcEEEE' in read-only section .text._ZN7testing8internal11MatcherBaseISt17basic_string_viewIcSt11char_traitsIcEEEC2INS0_9EqMatcherINSt7__cxx1112basic_stringIcS4_SaIcEEEEEvEEOT_[_ZN7testing8internal11MatcherBaseISt17basic_string_viewIcSt11char_traitsIcEEEC5INS0_9EqMatcherINSt7__cxx1112basic_stringIcS4_SaIcEEEEEvEEOT_]' /usr/bin/ld: ../../../lib/libgmock.a(gmock-all.cc.o): relocation R_X86_64_PC32 against symbol _ZN7testing19FLAGS_gmock_verboseB5cxx11E' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: bad value
1 parent 0c206eb commit 3509866

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
66
add_compile_definitions(DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
77

88
set(GTEST_DIR thirdparty/googletest)
9+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
910
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../${GTEST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${GTEST_DIR})
1011

1112
# For Windows: Prevent overriding the parent project's compiler/linker settings

0 commit comments

Comments
 (0)