/CGTHREADS (Compiler Threads)
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
Sets the number of cl.exe threads to use for optimization and code generation when link-time code generation is specified.
The maximum number of threads for cl.exe to use, in the range 1 to 8.
The /CGTHREADS option specifies the maximum number of threads cl.exe uses in parallel for the optimization and code-generation phases of compilation when link-time code generation (/LTCG) is specified. By default, cl.exe uses four threads, as if /CGTHREADS:4 were specified. If more processor cores are available, a larger
number value can improve build times.
Multiple levels of parallelism can be specified for a build. The msbuild.exe switch /maxcpucount specifies the number of MSBuild processes that can be run in parallel. The /MP (Build with Multiple Processes) compiler flag specifies the number of cl.exe processes that simultaneously compile the source files. The /cgthreads compiler option specifies the number of threads used by each cl.exe process. Because the processor can only run as many threads at the same time as there are processor cores, it's not useful to specify larger values for all of these options at the same time, and it can be counterproductive. For more information about how to build projects in parallel, see Building Multiple Projects in Parallel.
Open the project's Property Pages dialog box. For details, see Working with Project Properties.
Select the Configuration Properties, Linker folder.
Select the Command Line property page.
Modify the Additional Options property to include /CGTHREADS:
numberis a value from 1 to 8, and then choose OK.
- See AdditionalOptions.