Improve the message shown when position-independent code is not supported

This commit is contained in:
Username404 2021-11-12 21:24:43 +01:00
parent a4575a726d
commit 9c7210cb65
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 4 additions and 4 deletions

View File

@ -22,11 +22,11 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(CheckPIESupported)
check_pie_supported(OUTPUT_VARIABLE pie_output LANGUAGES CXX)
if (NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(WARNING "Link-time PIE not supported\n${pie_output}")
else()
check_pie_supported(LANGUAGES CXX)
if (CMAKE_CXX_LINK_PIE_SUPPORTED)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
else()
message(NOTICE "Position-Independent Code (PIC) is not supported by the current toolchain")
endif()
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS_RELEASE "-Os")