aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/modules/HandleLLVMOptions.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/HandleLLVMOptions.cmake')
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake19
1 files changed, 18 insertions, 1 deletions
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 6788f8e..3a10a86 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -76,7 +76,7 @@ if( LLVM_ENABLE_PIC )
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
# know how to disable this, so just force ENABLE_PIC off for now.
message(WARNING "-fPIC not supported with Xcode.")
- elseif( WIN32 )
+ elseif( WIN32 OR CYGWIN)
# On Windows all code is PIC. MinGW warns if -fPIC is used.
else()
include(CheckCXXCompilerFlag)
@@ -88,6 +88,15 @@ if( LLVM_ENABLE_PIC )
else( SUPPORTS_FPIC_FLAG )
message(WARNING "-fPIC not supported.")
endif()
+
+ if( WIN32 OR CYGWIN)
+ # MinGW warns if -fvisibility-inlines-hidden is used.
+ else()
+ check_cxx_compiler_flag("-fvisibility-inlines-hidden" SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG)
+ if( SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG )
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
+ endif()
+ endif()
endif()
endif()
@@ -127,6 +136,10 @@ endif()
if( MSVC )
include(ChooseMSVCCRT)
+ if( MSVC11 )
+ add_llvm_definitions(-D_VARIADIC_MAX=10)
+ endif()
+
# Add definitions that make MSVC much less annoying.
add_llvm_definitions(
# For some reason MS wants to deprecate a bunch of standard functions...
@@ -173,6 +186,10 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
if (LLVM_ENABLE_PEDANTIC)
add_llvm_definitions( -pedantic -Wno-long-long )
endif (LLVM_ENABLE_PEDANTIC)
+ check_cxx_compiler_flag("-Werror -Wcovered-switch-default" SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG)
+ if( SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG )
+ add_llvm_definitions( -Wcovered-switch-default )
+ endif()
endif (LLVM_ENABLE_WARNINGS)
if (LLVM_ENABLE_WERROR)
add_llvm_definitions( -Werror )