[ASan] Optional support for dynamic ASan runtime on Linux.
[blocksruntime.git] / cmake / config-ix.cmake
blobfe194d50d87e34f3bb9ca30da91ed0d7d2f1db4c
1 include(CheckCXXCompilerFlag)
2 include(CheckLibraryExists)
3 include(CheckSymbolExists)
5 # CodeGen options.
6 check_cxx_compiler_flag(-fPIC                COMPILER_RT_HAS_FPIC_FLAG)
7 check_cxx_compiler_flag(-fPIE                COMPILER_RT_HAS_FPIE_FLAG)
8 check_cxx_compiler_flag(-fno-builtin         COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
9 check_cxx_compiler_flag(-fno-exceptions      COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
10 check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)
11 check_cxx_compiler_flag(-funwind-tables      COMPILER_RT_HAS_FUNWIND_TABLES_FLAG)
12 check_cxx_compiler_flag(-fno-stack-protector COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG)
13 check_cxx_compiler_flag(-fvisibility=hidden  COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
14 check_cxx_compiler_flag(-fno-rtti            COMPILER_RT_HAS_FNO_RTTI_FLAG)
15 check_cxx_compiler_flag(-ffreestanding       COMPILER_RT_HAS_FFREESTANDING_FLAG)
16 check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
17 check_cxx_compiler_flag(-std=c++11           COMPILER_RT_HAS_STD_CXX11_FLAG)
18 check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
20 check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
21 check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
22 check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
23 check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
25 # Debug info flags.
26 check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
27 check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
28 check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
30 # Warnings.
31 check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
32 check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
33 check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG)
34 check_cxx_compiler_flag("-Werror -Wglobal-constructors"   COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)
35 check_cxx_compiler_flag("-Werror -Wno-c99-extensions"     COMPILER_RT_HAS_WNO_C99_EXTENSIONS_FLAG)
36 check_cxx_compiler_flag("-Werror -Wno-gnu"                COMPILER_RT_HAS_WNO_GNU_FLAG)
37 check_cxx_compiler_flag("-Werror -Wno-non-virtual-dtor"   COMPILER_RT_HAS_WNO_NON_VIRTUAL_DTOR_FLAG)
38 check_cxx_compiler_flag("-Werror -Wno-variadic-macros"    COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG)
40 check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
41 check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
42 check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
44 # Symbols.
45 check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
47 # Libraries.
48 check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
49 check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)