Index: cmake/modules/HandleLLVMOptions.cmake =================================================================== --- cmake/modules/HandleLLVMOptions.cmake (revision 126807) +++ cmake/modules/HandleLLVMOptions.cmake (working copy) @@ -102,6 +102,27 @@ endif( LLVM_BUILD_32_BITS ) endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 ) +if( MSVC_IDE AND ( MSVC90 OR MSVC10 ) ) + # Only Visual Studio 2008 and 2010 officially supports /MP. + # Visual Studio 2005 do support it but it's experimental there. + if( NOT LLVM_COMPILER_JOBS STREQUAL "1" ) + if( LLVM_COMPILER_JOBS STREQUAL "0" ) + add_llvm_definitions( /MP ) + else() + if (MSVC10) + message(FATAL_ERROR + "Due to a bug in CMake only 0 and 1 is supported for " + "LLVM_COMPILER_JOBS when generating for Visual Studio 2010") + else() + message(STATUS "Number of parallel compiler jobs set to " ${LLVM_COMPILER_JOBS}) + add_llvm_definitions( /MP${LLVM_COMPILER_JOBS} ) + endif() + endif() + else() + message(STATUS "Parallel compilation disabled") + endif() +endif() + if( MSVC ) include(ChooseMSVCCRT) Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 126807) +++ CMakeLists.txt (working copy) @@ -133,6 +133,13 @@ include(AddLLVMDefinitions) +if( MSVC_IDE AND ( MSVC90 OR MSVC10 ) ) + # Only Visual Studio 2008 and 2010 officially supports /MP. + # Visual Studio 2005 do support it but it's experimental there. + set(LLVM_COMPILER_JOBS "0" CACHE STRING + "Number of parallel compiler jobs. 0 means use all processors. Default is 0.") +endif() + option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON) # MSVC has a gazillion warnings with this. Index: docs/CMake.html =================================================================== --- docs/CMake.html (revision 126807) +++ docs/CMake.html (working copy) @@ -452,6 +452,22 @@ +
+ Microsoft Visual C++ +
+ +
+ +
+
LLVM_COMPILER_JOBS:STRING
+
Specifies the maximum number of parallell compiler jobs to use + per project when building with msbuild or Visual Studio. Only supported for + Visual Studio 2008 and Visual Studio 2010 CMake generators. 0 means use all + processors. Default is 0.
+
+ +
+