diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -83,8 +83,7 @@ "${libname}" MATCHES ".*\.osx.*") foreach(arch ${LIB_ARCHS_${libname}}) list(APPEND target_flags - -target ${arch}-apple-macos${DARWIN_osx_MIN_VER} - -darwin-target-variant ${arch}-apple-ios13.1-macabi) + "SHELL:-target ${arch}-apple-macos${DARWIN_osx_MIN_VER} -darwin-target-variant ${arch}-apple-ios13.1-macabi") endforeach() endif() @@ -251,11 +250,9 @@ "${os}" MATCHES "^(osx)$") foreach(arch ${LIB_ARCHS_${libname}}) list(APPEND extra_cflags_${libname} - -target ${arch}-apple-macos${DARWIN_osx_MIN_VER} - -darwin-target-variant ${arch}-apple-ios13.1-macabi) + "SHELL:-target ${arch}-apple-macos${DARWIN_osx_MIN_VER} -darwin-target-variant ${arch}-apple-ios13.1-macabi") list(APPEND extra_link_flags_${libname} - -target ${arch}-apple-macos${DARWIN_osx_MIN_VER} - -darwin-target-variant ${arch}-apple-ios13.1-macabi) + "SHELL:-target ${arch}-apple-macos${DARWIN_osx_MIN_VER} -darwin-target-variant ${arch}-apple-ios13.1-macabi") endforeach() endif() endforeach() diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake --- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake @@ -304,8 +304,7 @@ "${LIB_OS}" MATCHES "^osx$") # Build the macOS builtins with Mac Catalyst support. list(APPEND builtin_cflags - -target ${LIB_ARCH}-apple-macos${DARWIN_osx_BUILTIN_MIN_VER} - -darwin-target-variant ${LIB_ARCH}-apple-ios13.1-macabi) + "SHELL:-target ${LIB_ARCH}-apple-macos${DARWIN_osx_BUILTIN_MIN_VER} -darwin-target-variant ${LIB_ARCH}-apple-ios13.1-macabi") endif() set_target_compile_flags(${libname} @@ -400,12 +399,12 @@ macro(darwin_add_builtin_libraries) set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes) - set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer") + set(CFLAGS -fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer) set(CMAKE_C_FLAGS "") set(CMAKE_CXX_FLAGS "") set(CMAKE_ASM_FLAGS "") - append_string_if(COMPILER_RT_HAS_ASM_LSE " -DHAS_ASM_LSE" CFLAGS) + append_list_if(COMPILER_RT_HAS_ASM_LSE -DHAS_ASM_LSE CFLAGS) set(PROFILE_SOURCES ../profile/InstrProfiling.c ../profile/InstrProfilingBuffer.c @@ -515,7 +514,7 @@ set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded) - set(CFLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding") + set(CFLAGS -Oz -Wall -fomit-frame-pointer -ffreestanding) set(CMAKE_C_FLAGS "") set(CMAKE_CXX_FLAGS "") set(CMAKE_ASM_FLAGS "") @@ -534,8 +533,8 @@ set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR ${COMPILER_RT_INSTALL_LIBRARY_DIR}/macho_embedded) - set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi") - set(CFLAGS_i386 "-march=pentium") + set(CFLAGS_armv7 -target thumbv7-apple-darwin-eabi) + set(CFLAGS_i386 -march=pentium) darwin_read_list_from_file(common_FUNCTIONS ${MACHO_SYM_DIR}/common.txt) darwin_read_list_from_file(thumb2_FUNCTIONS ${MACHO_SYM_DIR}/thumb2.txt) diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake --- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake +++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake @@ -5,19 +5,11 @@ # define a handy helper function for it. The compile flags setting in CMake # has serious issues that make its syntax challenging at best. function(set_target_compile_flags target) - set(argstring "") - foreach(arg ${ARGN}) - set(argstring "${argstring} ${arg}") - endforeach() - set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}") + set_property(TARGET ${target} PROPERTY COMPILE_OPTIONS ${ARGN}) endfunction() function(set_target_link_flags target) - set(argstring "") - foreach(arg ${ARGN}) - set(argstring "${argstring} ${arg}") - endforeach() - set_property(TARGET ${target} PROPERTY LINK_FLAGS "${argstring}") + set_property(TARGET ${target} PROPERTY LINK_OPTIONS ${ARGN}) endfunction() # Set the variable var_PYBOOL to True if var holds a true-ish string,