[llvm-branch-commits] [compiler-rt] 1410b72 - [compiler-rt] Fix a bug in the cmakelists file when CMAKE_CXX_FLAGS are empty
Stella Stamenova via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 3 10:31:35 PST 2020
Author: Stella Stamenova
Date: 2020-12-03T10:25:52-08:00
New Revision: 1410b72be3211fa2a3dffcc06c5dc904ae4a6fb4
URL: https://github.com/llvm/llvm-project/commit/1410b72be3211fa2a3dffcc06c5dc904ae4a6fb4
DIFF: https://github.com/llvm/llvm-project/commit/1410b72be3211fa2a3dffcc06c5dc904ae4a6fb4.diff
LOG: [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
Added:
Modified:
compiler-rt/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 7d99d3860381..30302c2c1427 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -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})
More information about the llvm-branch-commits
mailing list