Support configure -platform linux-clang-libc++
Detect libc++ config and add appropriate compiler and linker flags. Pick-to: 6.3 Change-Id: I9ec91b3ace987599d4e79e43b1b75aa67cd5caeb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
2f30e9d751
commit
f370a4c49c
@ -943,6 +943,11 @@ function(qt_config_compile_test name)
|
||||
|
||||
set(CMAKE_REQUIRED_FLAGS ${arg_COMPILE_OPTIONS})
|
||||
|
||||
# Pass -stdlib=libc++ on if necessary
|
||||
if (INPUT_stdlib_libcpp OR QT_FEATURE_stdlib_libcpp)
|
||||
list(APPEND CMAKE_REQUIRED_FLAGS "-stdlib=libc++")
|
||||
endif()
|
||||
|
||||
# For MSVC we need to explicitly pass -Zc:__cplusplus to get correct __cplusplus
|
||||
# define values. According to common/msvc-version.conf the flag is supported starting
|
||||
# with 1913.
|
||||
@ -1003,6 +1008,15 @@ function(qt_get_platform_try_compile_vars out_var)
|
||||
list(APPEND flags "CMAKE_C_STANDARD")
|
||||
list(APPEND flags "CMAKE_CXX_STANDARD")
|
||||
|
||||
# Pass -stdlib=libc++ on if necessary
|
||||
if (INPUT_stdlib_libcpp OR QT_FEATURE_stdlib_libcpp)
|
||||
if(CMAKE_CXX_FLAGS)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -stdlib=libc++")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "-stdlib=libc++")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Assemble the list with regular options.
|
||||
set(flags_cmd_line "")
|
||||
foreach(flag ${flags})
|
||||
|
@ -26,6 +26,11 @@ function(qt_internal_setup_public_platform_target)
|
||||
target_link_libraries(Platform INTERFACE log)
|
||||
endif()
|
||||
|
||||
if (QT_FEATURE_stdlib_libcpp)
|
||||
target_compile_options(Platform INTERFACE "-stdlib=libc++")
|
||||
target_link_options(Platform INTERFACE "-stdlib=libc++")
|
||||
endif()
|
||||
|
||||
qt_set_msvc_cplusplus_options(Platform INTERFACE)
|
||||
|
||||
# Propagate minimum C++ 17 via Platform to Qt consumers (apps), after the global features
|
||||
|
@ -733,6 +733,9 @@ function(guess_compiler_from_mkspec)
|
||||
if(guess_cxx_compiler AND NOT cxx_compiler STREQUAL "")
|
||||
push("-DCMAKE_CXX_COMPILER=${cxx_compiler}")
|
||||
endif()
|
||||
if(mkspec MATCHES "-libc\\+\\+$")
|
||||
push("-DINPUT_stdlib_libcpp=ON")
|
||||
endif()
|
||||
set(cmake_args "${cmake_args}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
@ -849,6 +849,11 @@ qt_feature("zstd" PRIVATE
|
||||
LABEL "Zstandard support"
|
||||
CONDITION ZSTD_FOUND
|
||||
)
|
||||
qt_feature("stdlib-libcpp" PRIVATE
|
||||
LABEL "Using stdlib=libc++"
|
||||
AUTODETECT OFF
|
||||
CONDITION LINUX AND NOT ANDROID
|
||||
)
|
||||
# special case begin
|
||||
# Check whether CMake was built with zstd support.
|
||||
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21552
|
||||
|
Loading…
x
Reference in New Issue
Block a user