summaryrefslogtreecommitdiffstats
path: root/llvm/cmake
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2011-01-07 20:31:03 +0000
committerOscar Fuentes <ofv@wanadoo.es>2011-01-07 20:31:03 +0000
commit9bf259581c8877014b96b488ef7de5885bea692c (patch)
tree387a01f0d3b4dd4382714dc9375f4a84a17a6d69 /llvm/cmake
parentd81f3c96599580f2a728bfe7e41b87639ecb7bb0 (diff)
downloadbcm5719-llvm-9bf259581c8877014b96b488ef7de5885bea692c.tar.gz
bcm5719-llvm-9bf259581c8877014b96b488ef7de5885bea692c.zip
Don't use -O3 on Mingw, as people report it as unreliable. Use -O2
instead. llvm-svn: 123028
Diffstat (limited to 'llvm/cmake')
-rw-r--r--llvm/cmake/modules/LLVMProcessSources.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/cmake/modules/LLVMProcessSources.cmake b/llvm/cmake/modules/LLVMProcessSources.cmake
index 5f59eac4511..98b61296db4 100644
--- a/llvm/cmake/modules/LLVMProcessSources.cmake
+++ b/llvm/cmake/modules/LLVMProcessSources.cmake
@@ -1,5 +1,15 @@
include(AddFileDependencies)
+macro(llvm_replace_compiler_option var old new)
+ # Replaces a compiler option or switch `old' in `var' by `new'.
+ # If `old' is not in `var', appends `new' to `var'.
+ # Example: llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
+ if( "${${var}}" MATCHES "(^| )${old}($| )" )
+ string( REGEX REPLACE "(^| )${old}($| )" " ${new} " ${var} "${${var}}" )
+ else()
+ set( ${var} "${${var}} ${new}" )
+ endif()
+endmacro(llvm_replace_compiler_option)
macro(add_td_sources srcs)
file(GLOB tds *.td)
OpenPOWER on IntegriCloud