diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/modules/HandleLLVMOptions.cmake | 7 | ||||
-rw-r--r-- | docs/CMake.rst | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e6fd506..5a8eb98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn") option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) +option(LLVM_STATIC_MSVC_RUNTIME "When using MSVC, link against the static run-time (/MT)" OFF) + option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON) if ( LLVM_USE_FOLDERS ) set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index ff71c00..9fdc708 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -41,13 +41,16 @@ else() endif() endif() -if(MSVC) - # Link release builds against the static runtime. +if(MSVC AND LLVM_STATIC_MSVC_RUNTIME) + # Link against the static runtime. foreach(flag CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL) llvm_replace_compiler_option("${flag}" "/MD" "/MT") endforeach() + foreach(flag CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG) + llvm_replace_compiler_option("${flag}" "/MDd" "/MTd") + endforeach() endif() if(WIN32) diff --git a/docs/CMake.rst b/docs/CMake.rst index c9fe538..69eeaab 100644 --- a/docs/CMake.rst +++ b/docs/CMake.rst @@ -280,6 +280,11 @@ LLVM-specific variables are ``Address``, ``Memory`` and ``MemoryWithOrigins``. Defaults to empty string. +**LLVM_STATIC_MSVC_RUNTIME**:BOOL + When building with MSVC, link against the static runtime library (/MT or /MTd + for release and debug builds, respectively) instead of the dynamic one. + Defaults to OFF. + Executing the test suite ======================== |