[CMake] Cleaning up flags for Darwin builtins
* Setting CMAKE_*_FLAGS_${BUILD_TYPE} isn't really needed since we're setting the same value everywhere
* functions sanitize variables differently from macros, darwin_add_embedded_builtin_libraries should be a macro otherwise it won't alter the variables.
llvm-svn: 252618
diff --git a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
index 7b61dc0..1719506 100644
--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -255,16 +255,7 @@
macro(darwin_add_builtin_libraries)
set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
- if(CMAKE_CONFIGURATION_TYPES)
- foreach(type ${CMAKE_CONFIGURATION_TYPES})
- set(CMAKE_C_FLAGS_${type} -O3)
- set(CMAKE_CXX_FLAGS_${type} -O3)
- endforeach()
- else()
- set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} -O3)
- endif()
-
- set(CMAKE_C_FLAGS "-fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer")
+ set(CMAKE_C_FLAGS "-O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer")
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS})
@@ -343,7 +334,7 @@
darwin_add_embedded_builtin_libraries()
endmacro()
-function(darwin_add_embedded_builtin_libraries)
+macro(darwin_add_embedded_builtin_libraries)
# this is a hacky opt-out. If you can't target both intel and arm
# architectures we bail here.
set(DARWIN_SOFT_FLOAT_ARCHS armv6m armv7m armv7em armv7)
@@ -363,16 +354,8 @@
endif()
set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded)
- if(CMAKE_CONFIGURATION_TYPES)
- foreach(type ${CMAKE_CONFIGURATION_TYPES})
- set(CMAKE_C_FLAGS_${type} -Oz)
- set(CMAKE_CXX_FLAGS_${type} -Oz)
- endforeach()
- else()
- set(CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE} -Oz)
- endif()
- set(CMAKE_C_FLAGS "-Wall -fomit-frame-pointer -ffreestanding")
+ set(CMAKE_C_FLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding")
set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS})
@@ -390,8 +373,6 @@
${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
- set(CFLAGS_armv7em "-target thumbv7-apple-darwin-eabi")
- set(CFLAGS_armv7m "-target thumbv7-apple-darwin-eabi")
set(CFLAGS_i386 "-march=pentium")
darwin_read_list_from_file(common_FUNCTIONS ${MACHO_SYM_DIR}/common.txt)
@@ -450,4 +431,4 @@
INSTALL_DIR ${DARWIN_macho_embedded_LIBRARY_INSTALL_DIR})
endforeach()
endforeach()
-endfunction()
+endmacro()