Skip to content

Commit a53ae12

Browse files
committed
[FIXUP] Use Multi-ToolTask in MSVC builds by default
It allows to build as simple as `cmake --build . -j<JOBS>`.
1 parent 3f513eb commit a53ae12

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ if(WIN32)
102102
if(MSVC)
103103
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
104104
add_compile_options(/utf-8 /Zc:__cplusplus)
105+
# Improve parallelism in MSBuild.
106+
# See: https://devblogs.microsoft.com/cppblog/improved-parallelism-in-msbuild/.
107+
list(APPEND CMAKE_VS_GLOBALS "UseMultiToolTask=true")
105108
endif()
106109

107110
if(MINGW)

cmake/optional.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ if(CCACHE)
1313
set(MSVC_CCACHE_WRAPPER_CONTENT "\"${CCACHE_EXECUTABLE}\" \"${CMAKE_CXX_COMPILER}\"")
1414
set(MSVC_CCACHE_WRAPPER_FILENAME wrapped-cl.bat)
1515
file(WRITE ${CMAKE_BINARY_DIR}/${MSVC_CCACHE_WRAPPER_FILENAME} "${MSVC_CCACHE_WRAPPER_CONTENT} %*")
16-
set(CMAKE_VS_GLOBALS
16+
list(APPEND CMAKE_VS_GLOBALS
1717
"CLToolExe=${MSVC_CCACHE_WRAPPER_FILENAME}"
1818
"CLToolPath=${CMAKE_BINARY_DIR}"
1919
"TrackFileAccess=false"
20-
"UseMultiToolTask=true"
2120
"DebugInformationFormat=OldStyle"
2221
)
2322
else()

0 commit comments

Comments
 (0)