build: make UPX executable optional (not available e.g. on RISC-V)

This commit is contained in:
Marcus Holland-Moritz 2025-06-28 08:19:02 +02:00 committed by mhx
parent e626bf4bc8
commit ddcf7d3697

View File

@ -1042,8 +1042,9 @@ if(STATIC_BUILD_DO_NOT_USE OR WIN32)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
else()
find_program(UPX_EXE upx upx.exe PATHS "c:/bin" DOC "ultimate packer for executables" REQUIRED)
find_program(UPX_EXE upx upx.exe PATHS "c:/bin" DOC "ultimate packer for executables")
if(UPX_EXE)
# upx -9 is a good compromise between compression ratio and speed
# also, anything above --best increases the startup time of the compressed
# executable significantly
@ -1053,6 +1054,7 @@ if(STATIC_BUILD_DO_NOT_USE OR WIN32)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif()
endif()
list(APPEND UNIVERSAL_UPX_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/${UNIVERSAL_OUT})
set(UNIVERSAL_ENV_LIST "${UNIVERSAL_ENV_LIST}${tgt}_binary=${UNIVERSAL_OUT}\n")