llvm.org GIT mirror llvm / 47415a6
Revert r361826, as it still breaks LLDB. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361837 91177308-0d34-0410-b5e6-96231b3b80d8 Alexandre Ganea a month ago
3 changed file(s) with 1 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
434434 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
435435 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
436436
437 if (MSVC)
438 option(LLVM_ENABLE_INCREMENTAL_LINK "Link incrementally. Enabling it might produce slower executables." OFF)
439 endif()
440
441437 option(LLVM_ENABLE_DUMP "Enable dump functions even when assertions are disabled" OFF)
442438
443439 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
4949 set(${flagsvar} "${${flagsvar}}" CACHE STRING "${flagsvar_docs}" FORCE)
5050 endmacro(set_flag_in_var)
5151
52 macro(disable_MT_if_LLDB build message)
53 if (LLVM_TOOL_LLDB_BUILD)
54 if ((NOT ${build} STREQUAL "DEBUG") AND (LLVM_USE_CRT_${build} STREQUAL "MT"))
55 if (LLVM_TOOL_CLANG_BUILD OR LLVM_TOOL_LLD_BUILD)
56 set(performance " This might impact runtime performance for Clang or LLD. Preferably build them separately.")
57 endif()
58 message(WARNING "${message}.${performance}")
59 set(LLVM_USE_CRT_${build} "MD")
60 endif()
61 endif()
62 endmacro(disable_MT_if_LLDB)
6352
6453 macro(choose_msvc_crt MSVC_CRT)
6554 if(LLVM_USE_CRT)
7665 get_current_crt(LLVM_USE_CRT_${build}
7766 MSVC_CRT_REGEX
7867 CMAKE_CXX_FLAGS_${build})
79
80 # Make /MT the default in Release builds to make them faster
81 # and avoid the DLL function thunking.
82 if ((${build} STREQUAL "MINSIZEREL") OR
83 (${build} STREQUAL "RELEASE") OR
84 (${build} STREQUAL "RELWITHDEBINFO"))
85 set(LLVM_USE_CRT_${build} "MT")
86 endif()
87
88 disable_MT_if_LLDB(${build} "Using /MD as required by LLDB")
89
9068 set(LLVM_USE_CRT_${build}
9169 "${LLVM_USE_CRT_${build}}"
9270 CACHE STRING "Specify VC++ CRT to use for ${build_type} configurations."
9371 FORCE)
9472 set_property(CACHE LLVM_USE_CRT_${build}
9573 PROPERTY STRINGS ;${${MSVC_CRT}})
96 else()
97 disable_MT_if_LLDB(${build} "Disabling /MT as required by LLDB")
98 endif()
74 endif(NOT LLVM_USE_CRT_${build})
9975 endforeach(build_type)
10076
10177 foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
416416
417417 # "Enforce type conversion rules".
418418 append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
419
420 if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND NOT LLVM_ENABLE_INCREMENTAL_LINK)
421 foreach(CONFIG RELEASE RELWITHDEBINFO MINSIZEREL)
422 foreach(FLAG EXE MODULE SHARED STATIC)
423 string(REGEX REPLACE "[-/](INCREMENTAL:YES|INCREMENTAL:NO|INCREMENTAL)" "/INCREMENTAL:NO" CMAKE_${FLAG}_LINKER_FLAGS_${CONFIG} "${CMAKE_${FLAG}_LINKER_FLAGS_${CONFIG}}")
424 endforeach()
425 endforeach()
426 endif()
427419
428420 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT LLVM_ENABLE_LTO)
429421 # clang-cl and cl by default produce non-deterministic binaries because