Add '-stdlib=libc++' only for c++ compilers

Pick-to: 6.2 6.3
Task-number: QTBUG-101602
Change-Id: I4ecbb73f845d94156189acfd1a3074b676c90fc4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Alexey Edelev 2022-03-09 16:40:25 +01:00
parent b15e01ff4e
commit d1e02c3855

View File

@ -27,8 +27,12 @@ function(qt_internal_setup_public_platform_target)
endif()
if (QT_FEATURE_stdlib_libcpp)
target_compile_options(Platform INTERFACE "-stdlib=libc++")
target_link_options(Platform INTERFACE "-stdlib=libc++")
target_compile_options(Platform INTERFACE "$<$<COMPILE_LANGUAGE:CXX>:-stdlib=libc++>")
set(libc_link_option "-stdlib=libc++")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
set(libc_link_option "$<$<LINK_LANGUAGE:CXX>:-stdlib=libc++>")
endif()
target_link_options(Platform INTERFACE "${libc_link_option}")
endif()
if (QT_FEATURE_no_extern_direct_access)
target_compile_options(Platform INTERFACE "-mno-direct-extern-access")