Add NOMINMAX to PlatformCommonInternal
By not explicitly disabling min/max macros of `windows.h`, we may see some unintended substitutions. This is especially important now that we are moving toward enabling Unity Build, and some of the constructs for manually dealing with this issue, eg., `#ifdef max`, `#undef max`, might not make it to the pool, and as a result we get build failure. Pick-to: 6.5 Change-Id: Ie3c31aebe00300126a2ac3a6044876ab92d5d99c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
4e860a66d6
commit
585dd9d8d5
@ -184,6 +184,9 @@ function(qt_internal_add_headersclean_target module_target module_headers)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
set(hcleanFLAGS -std:c++latest -Zc:__cplusplus -Za -WX -W3 -EHsc)
|
||||
|
||||
# Because we now add `-DNOMINMAX` to `PlatformCommonInternal`.
|
||||
set(hcleanUDEFS -UNOMINMAX)
|
||||
|
||||
# cl.exe needs a source path
|
||||
get_filename_component(source_path "${QT_MKSPECS_DIR}/features/data/dummy.cpp" REALPATH)
|
||||
|
||||
@ -194,6 +197,7 @@ function(qt_internal_add_headersclean_target module_target module_headers)
|
||||
"${hcleanFLAGS}"
|
||||
"${target_includes_joined_genex}"
|
||||
"${hcleanDEFS}"
|
||||
"${hcleanUDEFS}"
|
||||
)
|
||||
string(JOIN " " compiler_command_line_variables
|
||||
"-FI"
|
||||
|
@ -170,6 +170,8 @@ if(WIN32)
|
||||
# Needed for M_PI define. Same as mkspecs/features/qt_module.prf.
|
||||
# It's set for every module being built, but it's not propagated to user apps.
|
||||
target_compile_definitions(PlatformModuleInternal INTERFACE _USE_MATH_DEFINES)
|
||||
# Not disabling min/max macros may result in unintended substitutions of std::min/max
|
||||
target_compile_definitions(PlatformCommonInternal INTERFACE NOMINMAX)
|
||||
endif()
|
||||
if(FEATURE_largefile AND UNIX)
|
||||
target_compile_definitions(PlatformCommonInternal
|
||||
|
Loading…
Reference in New Issue
Block a user