llvm.org GIT mirror llvm / 4ac2e3c
CMake: make building with /MT an option instead of always forcing it for release builds. This is a follow-up to r194589. Aaron pointed out that building libraries with /MT and using them in an application that uses a different run-time library can be a bad idea. Move the option to build with /MT behind a CMake option so it can be turned on selectively, such as when building the toolchain installer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194596 91177308-0d34-0410-b5e6-96231b3b80d8 Hans Wennborg 5 years ago
3 changed file(s) with 12 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1515 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn")
1616
1717 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
18
19 option(LLVM_STATIC_MSVC_RUNTIME "When using MSVC, link against the static run-time (/MT)" OFF)
1820
1921 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
2022 if ( LLVM_USE_FOLDERS )
4040 endif()
4141 endif()
4242
43 if(MSVC)
44 # Link release builds against the static runtime.
43 if(MSVC AND LLVM_STATIC_MSVC_RUNTIME)
44 # Link against the static runtime.
4545 foreach(flag CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
4646 CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE
4747 CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL)
4848 llvm_replace_compiler_option("${flag}" "/MD" "/MT")
49 endforeach()
50 foreach(flag CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG)
51 llvm_replace_compiler_option("${flag}" "/MDd" "/MTd")
4952 endforeach()
5053 endif()
5154
278278 Define the sanitizer used to build LLVM binaries and tests. Possible values
279279 are ``Address``, ``Memory`` and ``MemoryWithOrigins``. Defaults to empty
280280 string.
281
282 **LLVM_STATIC_MSVC_RUNTIME**:BOOL
283 When building with MSVC, link against the static runtime library (/MT or /MTd
284 for release and debug builds, respectively) instead of the dynamic one.
285 Defaults to OFF.
281286
282287 Executing the test suite
283288 ========================