Improve clang-cl support for Qt6
1. clang-cl doesn't support "-fno-exceptions", it uses msvc's parameter. 2. some parameters supported by msvc are not supported by clang-cl and they are causing huge warning message flood, don't add them. 3. use correct optimize parameter for clang-cl. Change-Id: Idbadf139127143c5fa6c49068588cb26f47da7a2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
2b4a581f34
commit
4b694032df
@ -158,6 +158,11 @@ if(MSVC)
|
||||
set(QT_CFLAGS_OPTIMIZE_DEBUG "-Od")
|
||||
set(QT_CFLAGS_OPTIMIZE_SIZE "-O1")
|
||||
set(QT_CFLAGS_OPTIMIZE_VALID_VALUES "/O2" "/O1" "/Od" "/Ob0" "/Ob1" "/Ob2" "/O0" "-O0")
|
||||
|
||||
if(CLANG)
|
||||
set(QT_CFLAGS_OPTIMIZE_FULL "/clang:-O3")
|
||||
set(QT_CFLAGS_OPTIMIZE_SIZE "/clang:-Oz")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Android Clang
|
||||
|
@ -92,7 +92,7 @@ function(qt_internal_apply_gc_binaries target visibility)
|
||||
message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.")
|
||||
endif()
|
||||
|
||||
if ((GCC OR CLANG) AND NOT EMSCRIPTEN AND NOT UIKIT)
|
||||
if ((GCC OR CLANG) AND NOT EMSCRIPTEN AND NOT UIKIT AND NOT MSVC)
|
||||
if(APPLE)
|
||||
set(gc_sections_flag "-Wl,-dead_strip")
|
||||
elseif(SOLARIS)
|
||||
@ -105,7 +105,7 @@ function(qt_internal_apply_gc_binaries target visibility)
|
||||
target_link_options("${target}" ${visibility} "${gc_sections_flag}")
|
||||
endif()
|
||||
|
||||
if((GCC OR CLANG OR ICC) AND NOT EMSCRIPTEN AND NOT UIKIT)
|
||||
if((GCC OR CLANG OR ICC) AND NOT EMSCRIPTEN AND NOT UIKIT AND NOT MSVC)
|
||||
set(split_sections_flags "-ffunction-sections" "-fdata-sections")
|
||||
endif()
|
||||
if(split_sections_flags)
|
||||
@ -149,15 +149,22 @@ endfunction()
|
||||
function(qt_internal_set_no_exceptions_flags target)
|
||||
target_compile_definitions("${target}" PRIVATE "QT_NO_EXCEPTIONS")
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
target_compile_options("${target}" PRIVATE "/wd4530" "/wd4577")
|
||||
set(_flag "/wd4530" "/wd4577")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
target_compile_options("${target}" PRIVATE "-fno-exceptions")
|
||||
set(_flag "-fno-exceptions")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
target_compile_options("${target}" PRIVATE "-fno-exceptions")
|
||||
set(_flag "-fno-exceptions")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
target_compile_options("${target}" PRIVATE "-fno-exceptions")
|
||||
if (MSVC)
|
||||
set(_flag "/wd4530" "/wd4577")
|
||||
else()
|
||||
set(_flag "-fno-exceptions")
|
||||
endif()
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
||||
target_compile_options("${target}" PRIVATE "-fno-exceptions")
|
||||
set(_flag "-fno-exceptions")
|
||||
endif()
|
||||
if (_flag)
|
||||
target_compile_options("${target}" PRIVATE ${_flag})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
@ -178,15 +178,19 @@ if (MSVC)
|
||||
if (MSVC_VERSION GREATER_EQUAL 1899)
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:strictStrings
|
||||
-Zc:throwingNew
|
||||
)
|
||||
if (NOT CLANG)
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:throwingNew
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
if (MSVC_VERSION GREATER_EQUAL 1909)
|
||||
if (MSVC_VERSION GREATER_EQUAL 1909 AND NOT CLANG)
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:referenceBinding
|
||||
)
|
||||
endif()
|
||||
if (MSVC_VERSION GREATER_EQUAL 1919)
|
||||
if (MSVC_VERSION GREATER_EQUAL 1919 AND NOT CLANG)
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
-Zc:externConstexpr
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user