Skip to content

Commit 472278a

Browse files
committed
Update the documentation and CMake file for Visual Studio generators.
By default, CMake uses a 32-bit toolchain, even when on a 64-bit platform targeting a 64-bit build. However, due to the size of the binaries involved, this can cause linker instabilities (such as the linker running out of memory). Guide people to the correct solution to get CMake to use the native toolchain. llvm-svn: 303912
1 parent f3509b6 commit 472278a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

llvm/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ if (NOT PACKAGE_VERSION)
4444
"${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}")
4545
endif()
4646

47+
if ((CMAKE_GENERATOR MATCHES "Visual Studio") AND (CMAKE_GENERATOR_TOOLSET STREQUAL ""))
48+
message(WARNING "Visual Studio generators use the x86 host compiler by "
49+
"default, even for 64-bit targets. This can result in linker "
50+
"instability and out of memory errors. To use the 64-bit "
51+
"host compiler, pass -Thost=x64 on the CMake command line.")
52+
endif()
53+
4754
project(LLVM
4855
${cmake_3_0_PROJ_VERSION}
4956
${cmake_3_0_LANGUAGES}

llvm/docs/GettingStartedVS.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ Here's the short story for getting up and running quickly with LLVM:
100100
* CMake generates project files for all build types. To select a specific
101101
build type, use the Configuration manager from the VS IDE or the
102102
``/property:Configuration`` command line option when using MSBuild.
103+
* By default, the Visual Studio project files generated by CMake use the
104+
32-bit toolset. If you are developing on a 64-bit version of Windows and
105+
want to use the 64-bit toolset, pass the ``-Thost=x64`` flag when
106+
generating the Visual Studio solution. This requires CMake 3.8.0 or later.
103107

104108
6. Start Visual Studio
105109

0 commit comments

Comments
 (0)