[CMake] Attempt to fix standalone compiler-rt build on Windows
[blocksruntime.git] / cmake / config-ix.cmake
blob09911db7b83a29bc44018b87f30f55086907366a
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)
18 check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
19 check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
20 check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
21 check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
23 # Debug info flags.
24 check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
25 check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
26 check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
28 # Warnings.
29 check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
30 check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
31 check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG)
32 check_cxx_compiler_flag("-Werror -Wglobal-constructors"   COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)
33 check_cxx_compiler_flag("-Werror -Wno-c99-extensions"     COMPILER_RT_HAS_WNO_C99_EXTENSIONS_FLAG)
34 check_cxx_compiler_flag("-Werror -Wno-gnu"                COMPILER_RT_HAS_WNO_GNU_FLAG)
35 check_cxx_compiler_flag("-Werror -Wno-non-virtual-dtor"   COMPILER_RT_HAS_WNO_NON_VIRTUAL_DTOR_FLAG)
36 check_cxx_compiler_flag("-Werror -Wno-variadic-macros"    COMPILER_RT_HAS_WNO_VARIADIC_MACROS_FLAG)
38 check_cxx_compiler_flag(/W3 COMPILER_RT_HAS_W3_FLAG)
39 check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
40 check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
42 # Symbols.
43 check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
45 # Libraries.
46 check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
47 check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)