diff options
author | Gregor Jasny <gjasny@googlemail.com> | 2019-02-05 13:23:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-07 11:43:51 (GMT) |
commit | 8af334f5baa1a628895571491f67a4f7d9483d9b (patch) | |
tree | 23ed607ee777b3b3bfbbee6bde97794d3c6b0730 /Modules/CMakeDetermineCompilerId.cmake | |
parent | 6f23321d405930241fa431cfda7650f2993f0c19 (diff) | |
download | CMake-8af334f5baa1a628895571491f67a4f7d9483d9b.zip CMake-8af334f5baa1a628895571491f67a4f7d9483d9b.tar.gz CMake-8af334f5baa1a628895571491f67a4f7d9483d9b.tar.bz2 |
Xcode: Derive stdlib from CXX flags
Closes: #18396
Diffstat (limited to 'Modules/CMakeDetermineCompilerId.cmake')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 2f84c8e..83ce392 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -360,6 +360,15 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} else() set(id_sdkroot "") endif() + set(id_clang_cxx_library "") + set(stdlib_regex "(^| )(-stdlib=)([^ ]+)( |$)") + string(REGEX MATCHALL "${stdlib_regex}" all_stdlib_matches "${CMAKE_CXX_FLAGS}") + if(all_stdlib_matches) + list(GET all_stdlib_matches "-1" last_stdlib_match) + if(last_stdlib_match MATCHES "${stdlib_regex}") + set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";") + endif() + endif() configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY) unset(_ENV_MACOSX_DEPLOYMENT_TARGET) |