From a534f3b758f8c9edf62ec0601d12394d4abb772a Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Tue, 2 Apr 2024 14:15:11 -0700 Subject: [PATCH] Conditionally add -pie --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9cb7de..f94807f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,9 +35,8 @@ endif() add_compile_options(-fdata-sections -ffunction-sections -Wswitch-enum -Werror=switch-enum -fPIC) -add_link_options(-pie) -set(full_relro_flags "LINKER:-z,relro,-z,now,-z,noexecstack") +set(full_relro_flags "-pie LINKER:-z,relro,-z,now,-z,noexecstack") cmake_push_check_state() list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${full_relro_flags}) check_cxx_source_compiles("int main(){}" HAS_FULL_RELRO FAIL_REGEX "warning:")