From 5b265d690f50d9cd200fc4b550377f55e710020b Mon Sep 17 00:00:00 2001 From: Username404 Date: Thu, 25 Mar 2021 16:50:03 +0100 Subject: [PATCH] Make the ybcon executable truly position-independent. --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5385cfb..199c307 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) set(CMAKE_CXX_FLAGS "-Wall") +if (CMAKE_POSITION_INDEPENDENT_CODE) + include(CheckPIESupported) + add_link_options("-pie") + check_pie_supported() +endif() + if (NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") endif()