CMakeLists.txt: Notify the user when CMAKE_POSITION_INDEPENDENT_CODE was defined on the command line although UPX is in use
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
510e7a24f3
commit
fec8a2c4bd
|
@ -23,8 +23,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
include(CheckPIESupported)
|
||||
check_pie_supported(LANGUAGES CXX)
|
||||
set(USER_DEFINED_PIE (DEFINED CMAKE_POSITION_INDEPENDENT_CODE))
|
||||
if (CMAKE_CXX_LINK_PIE_SUPPORTED)
|
||||
if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
if (NOT USER_DEFINED_PIE)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
endif()
|
||||
else()
|
||||
|
@ -161,6 +162,9 @@ if (NOT (UPPERCASE_BUILD_TYPE STREQUAL "DEBUG" OR UPPERCASE_BUILD_TYPE STREQUAL
|
|||
include(FindSelfPackers)
|
||||
if (SELF_PACKER_FOR_EXECUTABLE MATCHES upx) # UPX version d61edc9 or higher is required when using a cross-compiler to target the musl C library
|
||||
set(SELF_PACKER_FOR_EXECUTABLE_FLAGS ${SELF_PACKER_FOR_EXECUTABLE_FLAGS} --ultra-brute --best)
|
||||
if (USER_DEFINED_PIE AND CMAKE_POSITION_INDEPENDENT_CODE)
|
||||
message(NOTICE "-- Could NOT manually enable PIE (UPX is in use)")
|
||||
endif()
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE FALSE)
|
||||
set_target_properties(${EXENAME} PROPERTIES POSITION_INDEPENDENT_CODE ${CMAKE_POSITION_INDEPENDENT_CODE})
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue