summaryrefslogtreecommitdiff
path: root/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
commit53bf3ee82ba9fb6e6008b9752d4f8f4e71a4bfe4 (patch)
treefc8454872de6a8f1abedd10a93fa6acad41ef527 /cmake
parent8e3914d12e939d7c686bd121b0e2b2d39ed126d2 (diff)
downloadllvm-53bf3ee82ba9fb6e6008b9752d4f8f4e71a4bfe4.tar.gz
llvm-53bf3ee82ba9fb6e6008b9752d4f8f4e71a4bfe4.tar.bz2
llvm-53bf3ee82ba9fb6e6008b9752d4f8f4e71a4bfe4.tar.xz
Don't use -O3 on Mingw, as people report it as unreliable. Use -O2
instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/LLVMProcessSources.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/modules/LLVMProcessSources.cmake b/cmake/modules/LLVMProcessSources.cmake
index 5f59eac451..98b61296db 100644
--- a/cmake/modules/LLVMProcessSources.cmake
+++ b/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)