diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-12-14 09:38:29 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-12-14 20:04:43 +0100 |
commit | f370a4c49c686a54325efc5499449da8cdc4056e (patch) | |
tree | 402531d24fe457f0cd2cbbb6dc73ba8346c5febb /cmake/QtFeature.cmake | |
parent | 2f30e9d75195e01024df5df2ccdca4067fd448d5 (diff) |
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>
Diffstat (limited to 'cmake/QtFeature.cmake')
-rw-r--r-- | cmake/QtFeature.cmake | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake index c5e882649c..09a1c8361c 100644 --- a/cmake/QtFeature.cmake +++ b/cmake/QtFeature.cmake @@ -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}) |