From 3e6b6f95606763ffef8e3b3476857aef33fdc917 Mon Sep 17 00:00:00 2001 From: Username404 Date: Mon, 8 Aug 2022 12:52:44 +0200 Subject: [PATCH] CMakeLists.txt: Notify the user about position-independent code being unsupported only when it has been manually enabled Signed-off-by: Username404 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed8a818..3dd8a3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,8 +28,8 @@ if (CMAKE_CXX_LINK_PIE_SUPPORTED) if (NOT USER_DEFINED_PIE) set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) endif() -else() - message(NOTICE "Position-Independent Code (PIC) is not supported by the current toolchain") +elseif(USER_DEFINED_PIE AND CMAKE_POSITION_INDEPENDENT_CODE) + message(NOTICE "-- Could NOT manually enable Position-Independent Code (PIC) because it is not supported by the current toolchain") endif() set(CMAKE_CXX_FLAGS "-Wall") set(CMAKE_CXX_FLAGS_RELEASE "-Os")