mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[compiler-rt] Fix a bug in the cmakelists file when CMAKE_CXX_FLAGS are empty
Right now, the regex expression will fail if the flags were not set. Instead, we should follow the pattern of other llvm projects and quote the expression, so that it can work even when the flags are not set. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D92586
This commit is contained in:
@@ -457,8 +457,8 @@ append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ SANITIZER_COMMON_CFLA
|
||||
append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ SANITIZER_COMMON_LINK_FLAGS)
|
||||
|
||||
# Remove -stdlib= which is unused when passing -nostdinc++...
|
||||
string(REGEX MATCHALL "-stdlib=[a-zA-Z+]*" stdlib_flag ${CMAKE_CXX_FLAGS})
|
||||
string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
string(REGEX MATCHALL "-stdlib=[a-zA-Z+]*" stdlib_flag "${CMAKE_CXX_FLAGS}")
|
||||
string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
|
||||
# ...we need it to build some runtimes and tests so readd it where appropriate.
|
||||
list(APPEND COMPILER_RT_COMMON_CFLAGS ${stdlib_flag})
|
||||
|
||||
Reference in New Issue
Block a user