CMakeLists.txt: Don't set CMAKE_POSITION_INDEPENDENT_CODE to TRUE if it is already defined

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-08-08 12:26:34 +02:00
parent efe7d8ca57
commit 510e7a24f3
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,9 @@ set(CMAKE_CXX_EXTENSIONS OFF)
include(CheckPIESupported)
check_pie_supported(LANGUAGES CXX)
if (CMAKE_CXX_LINK_PIE_SUPPORTED)
if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
endif()
else()
message(NOTICE "Position-Independent Code (PIC) is not supported by the current toolchain")
endif()