From 706f8e7adf62d33bbe6adf1fd7516d3eacd697d9 Mon Sep 17 00:00:00 2001
From: Achim Gsell <achim.gsell@psi.ch>
Date: Thu, 28 Jun 2018 11:21:11 +0200
Subject: [PATCH] Master CMake script: add '-fPIE' to compile time and '-pie'
 to link options

---
 CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 333b5da5d..c2686243e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,10 +46,13 @@ add_definitions (-DIPPL_MPI -DMPICH_SKIP_MPICXX -DIPPL_DONT_POOL)
 add_definitions (-DIPPL_USE_XDIV_RNG -DPETE_BITWISE_COPY)
 add_definitions (-DIPPL_HAS_TEMPLATED_COMPLEX)
 add_definitions (-DIPPL_USE_PARTIAL_SPECIALIZATION)
-add_definitions ( -Drestrict=__restrict__ -DNOCTAssert)
+add_definitions (-Drestrict=__restrict__ -DNOCTAssert)
 
 add_compile_options (-Wall)
 add_compile_options (-funroll-loops -fstrict-aliasing)
+add_compile_options (-fPIE)
+
+set (CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -pie")
 
 # compiler dependent flags
 message ("The underlying C++ compiler ID is: ${CMAKE_CXX_COMPILER_ID}")
-- 
GitLab