diff --git a/CMakeLists.txt b/CMakeLists.txt index 3abd48bf87..eddd5bb8cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,10 +214,10 @@ if (APPLE) endif (APPLE) # set necessary flags to compile code as is -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 -fno-pie -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 -fno-pie -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 -fPIC -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 -fPIC -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations") +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M} -fpie") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS} -fpie") if (MINGW) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")