Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -26,10 +26,21 @@ 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.") + + if ((CMAKE_VERSION VERSION_LESS 3.8) OR (NOT "$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "AMD64")) + 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 or update to a newer version of CMake " + "(3.8+) where this will be set automatically on 64-bit " + "systems.") + else() + # CMake 3.8 introduces the following variable to allow us to select the + # 64-bit host Visual Studio toolchain. + set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE "x64") + endif() + endif() project(LLVM