Build relocatable code. (#413)

This is required to reuse code from cartographer_ros in cartographer_rviz. Otherwise linking fails with errors like these:

~~~
/usr/bin/ld: libcartographer_ros.a(msg_conversion.cc.o): relocation R_X86_64_32S against `_ZNSs4_Rep20_S_empty_rep_storageE' can not be use
d when making a shared object; recompile with -fPIC
~~~

While this could be fixed locally in cartographer_ros, it is a reasonable default to compile with `-fPIC` always.
master
Holger Rapp 2017-07-20 14:31:50 +02:00 committed by GitHub
parent 1bce14b7b5
commit 481211073f
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ macro(google_initialize_cartographer_project)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
endif() endif()
set(GOOG_CXX_FLAGS "-pthread -std=c++11 ${GOOG_CXX_FLAGS}") set(GOOG_CXX_FLAGS "-pthread -std=c++11 -fPIC ${GOOG_CXX_FLAGS}")
google_add_flag(GOOG_CXX_FLAGS "-Wall") google_add_flag(GOOG_CXX_FLAGS "-Wall")
google_add_flag(GOOG_CXX_FLAGS "-Wpedantic") google_add_flag(GOOG_CXX_FLAGS "-Wpedantic")