Add CMake options to build position-independent code (pie) 40/185140/1
authorTomasz Swierczek <t.swierczek@samsung.com>
Thu, 26 Jul 2018 08:06:15 +0000 (10:06 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 26 Jul 2018 08:06:40 +0000 (10:06 +0200)
Change-Id: I35a8635d7dd42d3fa801440dfc72691ad44201c9

CMakeLists.txt

index 24e6a903ee302b7a0cde38c838c8666ea4b4ece1..0c99cc011e57f477bbf0ca6c3ed904e7b70f8ce4 100644 (file)
@@ -32,6 +32,9 @@ find_package(Threads REQUIRED)
 INCLUDE(cmake/CheckFrameworks.cmake)
 INCLUDE(cmake/CStandard.cmake)
 
+SET(CMAKE_POSITION_INDEPENDENT_CODE "True")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
+
 option(ENABLE_DUMMY_BACKEND "Enable dummy crypto backend" OFF)
 option(ENABLE_SYSTEMD_SUPPORT "Enable support for systemd" ON)