[PATCH] D33546: Updated getting started guide for visual studio + cmake

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 13:18:53 PDT 2017


aaron.ballman updated this revision to Diff 100285.
aaron.ballman added a comment.
Herald added a subscriber: mgorny.

Now, with CMake warning. This is only needed for the llvm cmake files (since Clang relies on them anyway).

I couldn't find a way to tell if the host system architecture is not 64-bit in CMake (we could skip the diagnostic on 32-bit hosts), so if someone knows a good incantation for that, it could be useful. I was able to find ways if the target architecture is 64-bit, but that's not helpful since a 32-bit host can still target a 64-bit architecture.


https://reviews.llvm.org/D33546

Files:
  CMakeLists.txt
  docs/GettingStartedVS.rst


Index: docs/GettingStartedVS.rst
===================================================================
--- docs/GettingStartedVS.rst
+++ docs/GettingStartedVS.rst
@@ -100,6 +100,10 @@
    * CMake generates project files for all build types. To select a specific
      build type, use the Configuration manager from the VS IDE or the 
      ``/property:Configuration`` command line option when using MSBuild.
+   * By default, the Visual Studio project files generated by CMake use the
+     32-bit toolset. If you are developing on a 64-bit version of Windows and
+     want to use the 64-bit toolset, pass the ``-Thost=x64`` flag when
+     generating the Visual Studio solution. This requires CMake 3.8.0 or later.
 
 6. Start Visual Studio
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -44,6 +44,13 @@
     "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}")
 endif()
 
+if ((CMAKE_GENERATOR MATCHES "Visual Studio") AND (CMAKE_GENERATOR_TOOLSET STREQUAL ""))
+  message(WARNING "Visual Studio generators use the x86 host compiler by "
+                  "default, even for 64-bit targets. This can result in linker "
+                  "instability and out of memory errors. To use the 64-bit "
+                  "host compiler, pass -Thost=x64 on the CMake command line.")
+endif()
+
 project(LLVM
   ${cmake_3_0_PROJ_VERSION}
   ${cmake_3_0_LANGUAGES}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33546.100285.patch
Type: text/x-patch
Size: 1483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/fe7cfdc0/attachment.bin>


More information about the llvm-commits mailing list