cmake update

This commit is contained in:
Markus F.X.J. Oberhumer 2024-04-20 21:08:09 +02:00
parent e4de14612f
commit 896596f672
4 changed files with 37 additions and 24 deletions

View File

@ -236,10 +236,11 @@ if(NOT CMAKE_C_COMPILER_ID MATCHES "^MSVC")
endif()
endif()
# examine MinGW/Cygwin compiler configuration
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
# examine compiler configuration
if(NOT UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO)
upx_print_common_symbols()
upx_print_mingw_symbols()
endif()
endif() # UPX_CONFIG_CMAKE_DISABLE_PRINT_INFO
#***********************************************************************
# targets

View File

@ -65,10 +65,38 @@ macro(upx_apply_build_type)
endif()
endmacro()
# ternary conditional operator
macro(upx_ternary result_var_name condition true_value false_value)
if(${condition})
set(${result_var_name} "${true_value}")
else()
set(${result_var_name} "${false_value}")
endif()
endmacro()
#***********************************************************************
# util
#***********************************************************************
# convert to CMake bool
function(upx_make_bool_var result_var_name var_name default_value)
set(result "${default_value}")
# only query $var_name if it is defined and not empty
if(NOT ",${var_name}," STREQUAL ",,")
if(DEFINED ${var_name})
if(NOT ",${${var_name}}," STREQUAL ",,")
set(result "${${var_name}}")
endif()
endif()
endif()
if(${result})
set(result ON)
else()
set(result OFF)
endif()
set(${result_var_name} "${result}" PARENT_SCOPE) # return value
endfunction()
function(upx_print_var) # ARGV
foreach(var_name ${ARGV})
if(DEFINED ${var_name})
@ -101,22 +129,10 @@ function(upx_print_have_symbol) # ARGV; needs include(CheckSymbolExists)
endforeach()
endfunction()
function(upx_make_bool_var result_var_name var_name default_value)
set(result "${default_value}")
if(NOT ",${var_name}," STREQUAL ",,")
if(DEFINED ${var_name})
if(NOT ",${${var_name}}," STREQUAL ",,")
set(result "${${var_name}}")
endif()
endif()
endif()
# convert to bool
if(${result})
set(result ON)
else()
set(result OFF)
endif()
set(${result_var_name} "${result}" PARENT_SCOPE) # return value
# examine compiler configuration
function(upx_print_common_symbols)
upx_print_have_symbol(__FAST_MATH__)
upx_print_have_symbol(__PIC__ __pic__ __PIE__ __pie__)
endfunction()
# examine MinGW/Cygwin compiler configuration

View File

@ -366,10 +366,6 @@ struct TestTriBool {
static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type));
#if defined(__m68k__) && defined(__atarist__) && defined(__GNUC__)
// broken compiler or broken ABI
#elif defined(__i386__) && defined(__clang__) && (__clang_major__ < 9)
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
// i386: "long long" enum align bug/ABI problem on older compilers
static_assert(alignof(T) <= alignof(typename T::underlying_type));
#elif defined(__i386__) && defined(__GNUC__) && (__GNUC__ == 7) && !defined(__clang__)
static_assert(sizeof(T) == sizeof(typename T::underlying_type));
// i386: "long long" enum align bug/ABI problem on older compilers

View File

@ -55,7 +55,7 @@
#endif
#endif
#if defined(__clang__) && defined(__FAST_MATH__)
#if defined(__FAST_MATH__) && defined(__clang__) && (__clang_major__ + 0 >= 6)
// warning: comparison with NaN always evaluates to false in fast floating point modes
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
#endif