summaryrefslogtreecommitdiff
path: root/cmake/Modules/CompilerRTDarwinUtils.cmake
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-11-11 21:38:35 +0000
committerChris Bieneman <beanz@apple.com>2015-11-11 21:38:35 +0000
commit33dc9108c2f3d9fd3344d7eb7301509b678e8986 (patch)
tree506b9574804fb9c04ede527f8be7ccf0d29c2bf7 /cmake/Modules/CompilerRTDarwinUtils.cmake
parent1423f2d1b8a0e505da9911d920ae0131da4fc710 (diff)
downloadcompiler-rt-33dc9108c2f3d9fd3344d7eb7301509b678e8986.tar.gz
[CMake] [Darwin] [Builtins] Force setting the flags we care about at the end of the compiler command line
Setting CMAKE_*_FLAGS isn't sufficient here because CMAKE_*_FLAGS_${CMAKE_BUILD_TYPE} can override the flags, and there is no way to safely clear that because it is a cached variable (<sarcasm> YAY! </sarcasm>). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@252807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules/CompilerRTDarwinUtils.cmake')
-rw-r--r--cmake/Modules/CompilerRTDarwinUtils.cmake20
1 files changed, 11 insertions, 9 deletions
diff --git a/cmake/Modules/CompilerRTDarwinUtils.cmake b/cmake/Modules/CompilerRTDarwinUtils.cmake
index 0edee653c..18ddc0e3c 100644
--- a/cmake/Modules/CompilerRTDarwinUtils.cmake
+++ b/cmake/Modules/CompilerRTDarwinUtils.cmake
@@ -258,9 +258,10 @@ endfunction()
macro(darwin_add_builtin_libraries)
set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
- 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})
+ set(CFLAGS "-O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer")
+ set(CMAKE_C_FLAGS "")
+ set(CMAKE_CXX_FLAGS "")
+ set(CMAKE_ASM_FLAGS "")
set(PROFILE_SOURCES ../profile/InstrProfiling
../profile/InstrProfilingBuffer
@@ -281,7 +282,7 @@ macro(darwin_add_builtin_libraries)
OS ${os}
ARCH ${arch}
SOURCES ${filtered_sources}
- CFLAGS -arch ${arch}
+ CFLAGS ${CFLAGS} -arch ${arch}
PARENT_TARGET builtins)
endforeach()
@@ -304,7 +305,7 @@ macro(darwin_add_builtin_libraries)
OS ${os}
ARCH ${arch}
SOURCES ${filtered_sources} ${PROFILE_SOURCES}
- CFLAGS -arch ${arch} -mkernel
+ CFLAGS ${CFLAGS} -arch ${arch} -mkernel
DEFS KERNEL_USE
PARENT_TARGET builtins)
endforeach()
@@ -358,9 +359,10 @@ macro(darwin_add_embedded_builtin_libraries)
set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded)
- set(CMAKE_C_FLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding")
- set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
- set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS})
+ set(CFLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding")
+ set(CMAKE_C_FLAGS "")
+ set(CMAKE_CXX_FLAGS "")
+ set(CMAKE_ASM_FLAGS "")
set(SOFT_FLOAT_FLAG -mfloat-abi=soft)
set(HARD_FLOAT_FLAG -mfloat-abi=hard)
@@ -421,7 +423,7 @@ macro(darwin_add_embedded_builtin_libraries)
OS macho_embedded
ARCH ${arch}
SOURCES ${${arch}_filtered_sources}
- CFLAGS -arch ${arch} ${${type}_FLAG} ${float_flag} ${CFLAGS_${arch}}
+ CFLAGS ${CFLAGS} -arch ${arch} ${${type}_FLAG} ${float_flag} ${CFLAGS_${arch}}
PARENT_TARGET builtins)
endforeach()
foreach(lib ${macho_embedded_${lib_suffix}_libs})