Skip to content

Commit

Permalink
cmake: set CMAKE_POSITION_INDEPENDENT_CODE to ON on Unix
Browse files Browse the repository at this point in the history
This is needed because we're using the static libraries in a dynamic
library (the Unreal Plugin).

Fixes the error:
relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
  • Loading branch information
bkueng committed Feb 22, 2017
1 parent 8a5da9b commit 2072174
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cmake/cmake-modules/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ macro(CommonSetup)
set(CMAKE_CXX_FLAGS "-std=c++14 -ggdb -Wall -Wextra -Wstrict-aliasing -Werror -fmax-errors=2 -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option ${MAVLINK_OVERRIDES} ${BOOST_OVERRIDES} ${RPC_LIB_DEFINES} -Wl,--no-as-needed -ldl -ldl ${CMAKE_CXX_FLAGS}")
endif ()
set(BUILD_PLATFORM "x64")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

ELSE()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WIN32_WINNT=0x0600 /GS /W4 /wd4100 /wd4505 /wd4820 /wd4464 /wd4514 /wd4710 /wd4571 /Zc:wchar_t /ZI /Zc:inline /fp:precise /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_UNICODE /DUNICODE /WX- /Zc:forScope /Gd /EHsc ")
Expand Down

0 comments on commit 2072174

Please sign in to comment.