11---
22title : " CMake predefined configuration reference"
33ms.description : " Visual Studio provides several predefined build configurations for CMake projects on Linux, Windows, ARM, and IoT."
4- ms.date : " 05/15 /2019"
4+ ms.date : " 06/12 /2019"
55helpviewer_keywords : ["CMake redefined configurations"]
66---
77
88# CMake predefined build configurations
99
10- In a CMake project, build configurations are stored in a CMakeSettings.json file. When you choose ** Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
11- - x86 Debug
10+ ::: moniker range="vs-2015"
11+
12+ CMake projects are supported in Visual Studio 2017 and later.
13+
14+ ::: moniker-end
15+
16+ ::: moniker range="vs-2017"
17+
18+ In a CMake project, build configurations are stored in a CMakeSettings.json file. When you choose ** Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
19+ - x86 Debug
1220- x86 Release
1321- x64 Debug
1422- x64 Release
@@ -17,9 +25,9 @@ In a CMake project, build configurations are stored in a CMakeSettings.json file
1725- IoT Debug
1826- IoT Release
1927- MinGW Debug
20- - MinGW Release
28+ - MinGW Release
2129
22- When you choose a configuration, it is added to the CMakeSettings.json file in the project's root folder. You can then use it to build your project.
30+ When you choose a configuration, it is added to the CMakeSettings.json file in the project's root folder. You can then use it to build your project.
2331
2432
2533## Linux predefined build configurations:
@@ -337,7 +345,350 @@ These options allow you to run commands on the remote system before and after bu
337345 ]
338346}
339347```
348+ ::: moniker-end
349+
350+ ::: moniker range="vs-2019"
351+
352+ In a CMake project, build configurations are stored in a CMakeSettings.json file. When you choose ** Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
353+
354+ - x86 Debug
355+ - x86 Clang Debug
356+ - x86 Release
357+ - x86 Clang Release
358+ - x64 Debug
359+ - x64 Clang Debug
360+ - x64 Release
361+ - x64 Clang Release
362+ - Linux-Debug
363+ - Linux-Release
364+ - Linux-Clang-Debug
365+ - Linux-Clang-Release
366+ - Existing Cache (remote)
367+ - Existing Cache
368+ - MinGW Debug
369+ - MinGW Release
370+ - WSL Debug
371+ - WSL Release
372+ - WSL Clang Debug
373+ - WSL Clang Release
374+ - Clang
375+
376+ When you choose a configuration, it is added to the CMakeSettings.json file in the project's root folder. You can then use it to build your project.
377+
378+
379+ ``` json
380+ {
381+ "configurations" : [
382+ {
383+ "name" : " x64-Debug" ,
384+ "generator" : " Ninja" ,
385+ "configurationType" : " Release" ,
386+ "inheritEnvironments" : [ " msvc_x64_x64" ],
387+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
388+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
389+ "cmakeCommandArgs" : " " ,
390+ "buildCommandArgs" : " -v" ,
391+ "ctestCommandArgs" : " " ,
392+ "variables" : []
393+ },
394+ {
395+ "name" : " Linux-Debug" ,
396+ "generator" : " Unix Makefiles" ,
397+ "configurationType" : " Release" ,
398+ "cmakeExecutable" : " /usr/bin/cmake" ,
399+ "remoteCopySourcesExclusionList" : [ " .vs" , " .git" , " out" ],
400+ "cmakeCommandArgs" : " " ,
401+ "buildCommandArgs" : " " ,
402+ "ctestCommandArgs" : " " ,
403+ "inheritEnvironments" : [ " linux_x64" ],
404+ "remoteMachineName" : " ${defaultRemoteMachineName}" ,
405+ "remoteCMakeListsRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/src" ,
406+ "remoteBuildRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}" ,
407+ "remoteInstallRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}" ,
408+ "remoteCopySources" : true ,
409+ "rsyncCommandArgs" : " -t --delete --delete-excluded" ,
410+ "remoteCopyBuildOutput" : false ,
411+ "remoteCopySourcesMethod" : " rsync" ,
412+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
413+ "variables" : []
414+ },
415+ {
416+ "name" : " Linux-Release" ,
417+ "generator" : " Unix Makefiles" ,
418+ "configurationType" : " RelWithDebInfo" ,
419+ "cmakeExecutable" : " /usr/bin/cmake" ,
420+ "remoteCopySourcesExclusionList" : [ " .vs" , " .git" , " out" ],
421+ "cmakeCommandArgs" : " " ,
422+ "buildCommandArgs" : " " ,
423+ "ctestCommandArgs" : " " ,
424+ "inheritEnvironments" : [ " linux_x64" ],
425+ "remoteMachineName" : " ${defaultRemoteMachineName}" ,
426+ "remoteCMakeListsRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/src" ,
427+ "remoteBuildRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}" ,
428+ "remoteInstallRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}" ,
429+ "remoteCopySources" : true ,
430+ "rsyncCommandArgs" : " -t --delete --delete-excluded" ,
431+ "remoteCopyBuildOutput" : false ,
432+ "remoteCopySourcesMethod" : " rsync" ,
433+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
434+ "variables" : []
435+ },
436+ {
437+ "name" : " Linux-Clang-Debug" ,
438+ "generator" : " Unix Makefiles" ,
439+ "configurationType" : " Debug" ,
440+ "cmakeExecutable" : " /usr/bin/cmake" ,
441+ "remoteCopySourcesExclusionList" : [ " .vs" , " .git" , " out" ],
442+ "cmakeCommandArgs" : " " ,
443+ "buildCommandArgs" : " " ,
444+ "ctestCommandArgs" : " " ,
445+ "inheritEnvironments" : [ " linux_clang_x64" ],
446+ "remoteMachineName" : " ${defaultRemoteMachineName}" ,
447+ "remoteCMakeListsRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/src" ,
448+ "remoteBuildRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}" ,
449+ "remoteInstallRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}" ,
450+ "remoteCopySources" : true ,
451+ "rsyncCommandArgs" : " -t --delete --delete-excluded" ,
452+ "remoteCopyBuildOutput" : false ,
453+ "remoteCopySourcesMethod" : " rsync" ,
454+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
455+ "variables" : []
456+ },
457+ {
458+ "name" : " Linux-Clang-Release" ,
459+ "generator" : " Unix Makefiles" ,
460+ "configurationType" : " RelWithDebInfo" ,
461+ "cmakeExecutable" : " /usr/bin/cmake" ,
462+ "remoteCopySourcesExclusionList" : [ " .vs" , " .git" , " out" ],
463+ "cmakeCommandArgs" : " " ,
464+ "buildCommandArgs" : " " ,
465+ "ctestCommandArgs" : " " ,
466+ "inheritEnvironments" : [ " linux_clang_x64" ],
467+ "remoteMachineName" : " ${defaultRemoteMachineName}" ,
468+ "remoteCMakeListsRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/src" ,
469+ "remoteBuildRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}" ,
470+ "remoteInstallRoot" : " $HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}" ,
471+ "remoteCopySources" : true ,
472+ "rsyncCommandArgs" : " -t --delete --delete-excluded" ,
473+ "remoteCopyBuildOutput" : false ,
474+ "remoteCopySourcesMethod" : " rsync" ,
475+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
476+ "variables" : []
477+ },
478+ {
479+ "name" : " Existing Cache (Remote)" ,
480+ "cacheRoot" : " " ,
481+ "remoteCopySourcesExclusionList" : [ " .vs" , " .git" , " out" ],
482+ "inheritEnvironments" : [ " linux_x64" ],
483+ "remoteMachineName" : " ${defaultRemoteMachineName}" ,
484+ "remoteCopySources" : false ,
485+ "rsyncCommandArgs" : " -t --delete --delete-excluded" ,
486+ "remoteCopyBuildOutput" : false ,
487+ "remoteCopySourcesMethod" : " rsync" ,
488+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
489+ "variables" : []
490+ },
491+ {
492+ "name" : " Mingw64-Debug" ,
493+ "generator" : " Ninja" ,
494+ "configurationType" : " Debug" ,
495+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
496+ "installRoot" : " ${projectDir\\ out\\ install\\ ${name}" ,
497+ "cmakeCommandArgs" : " " ,
498+ "buildCommandArgs" : " -v" ,
499+ "ctestCommandArgs" : " " ,
500+ "inheritEnvironments" : [ " mingw_64" ],
501+ "environments" : [
502+ {
503+ "MINGW64_ROOT" : " C:\\ msys64\\ mingw64" ,
504+ "BIN_ROOT" : " ${env.MINGW64_ROOT}\\ bin" ,
505+ "FLAVOR" : " x86_64-w64-mingw32" ,
506+ "TOOLSET_VERSION" : " 7.3.0" ,
507+ "PATH" : " ${env.MINGW64_ROOT}\\ bin;${env.MINGW64_ROOT}\\ ..\\ usr\\ local\\ bin;${env.MINGW64_ROOT}\\ ..\\ usr\\ bin;${env.MINGW64_ROOT}\\ ..\\ bin;${env.PATH}" ,
508+ "INCLUDE" : " ${env.INCLUDE};${env.MINGW64_ROOT}\\ include\\ c++\\ ${env.TOOLSET_VERSION};${env.MINGW64_ROOT}\\ include\\ c++\\ ${env.TOOLSET_VERSION}\\ tr1;${env.MINGW64_ROOT}\\ include\\ c++\\ ${env.TOOLSET_VERSION}\\ ${env.FLAVOR}" ,
509+ "environment" : " mingw_64"
510+ }
511+ ],
512+ "variables" : [
513+ {
514+ "name" : " CMAKE_C_COMPILER" ,
515+ "value" : " ${env.BIN_ROOT}\\ gcc.exe" ,
516+ "type" : " STRING"
517+ },
518+ {
519+ "name" : " CMAKE_CXX_COMPILER" ,
520+ "value" : " ${env.BIN_ROOT}\\ g++.exe" ,
521+ "type" : " STRING"
522+ }
523+ ],
524+ "intelliSenseMode" : " linux-gcc-x64"
525+ },
526+ {
527+ "name" : " Mingw64-Release" ,
528+ "generator" : " Ninja" ,
529+ "configurationType" : " RelWithDebInfo" ,
530+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
531+ "installRoot" : " ${projectDir\\ out\\ install\\ ${name}" ,
532+ "cmakeCommandArgs" : " " ,
533+ "buildCommandArgs" : " -v" ,
534+ "ctestCommandArgs" : " " ,
535+ "inheritEnvironments" : [ " mingw_64" ],
536+ "environments" : [
537+ {
538+ "MINGW64_ROOT" : " C:\\ msys64\\ mingw64" ,
539+ "BIN_ROOT" : " ${env.MINGW64_ROOT}\\ bin" ,
540+ "FLAVOR" : " x86_64-w64-mingw32" ,
541+ "TOOLSET_VERSION" : " 7.3.0" ,
542+ "PATH" : " ${env.MINGW64_ROOT}\\ bin;${env.MINGW64_ROOT}\\ ..\\ usr\\ local\\ bin;${env.MINGW64_ROOT}\\ ..\\ usr\\ bin;${env.MINGW64_ROOT}\\ ..\\ bin;${env.PATH}" ,
543+ "INCLUDE" : " ${env.INCLUDE};${env.MINGW64_ROOT}\\ include\\ c++\\ ${env.TOOLSET_VERSION};${env.MINGW64_ROOT}\\ include\\ c++\\ ${env.TOOLSET_VERSION}\\ tr1;${env.MINGW64_ROOT}\\ include\\ c++\\ ${env.TOOLSET_VERSION}\\ ${env.FLAVOR}" ,
544+ "environment" : " mingw_64"
545+ }
546+ ],
547+ "variables" : [
548+ {
549+ "name" : " CMAKE_C_COMPILER" ,
550+ "value" : " ${env.BIN_ROOT}\\ gcc.exe" ,
551+ "type" : " STRING"
552+ },
553+ {
554+ "name" : " CMAKE_CXX_COMPILER" ,
555+ "value" : " ${env.BIN_ROOT}\\ g++.exe" ,
556+ "type" : " STRING"
557+ }
558+ ],
559+ "intelliSenseMode" : " linux-gcc-x64"
560+ },
561+ {
562+ "name" : " x64-Release" ,
563+ "generator" : " Ninja" ,
564+ "configurationType" : " RelWithDebInfo" ,
565+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
566+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
567+ "cmakeCommandArgs" : " " ,
568+ "buildCommandArgs" : " -v" ,
569+ "ctestCommandArgs" : " " ,
570+ "inheritEnvironments" : [ " msvc_x64_x64" ],
571+ "variables" : []
572+ },
573+ {
574+ "name" : " x86-Debug" ,
575+ "generator" : " Ninja" ,
576+ "configurationType" : " Debug" ,
577+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
578+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
579+ "cmakeCommandArgs" : " " ,
580+ "buildCommandArgs" : " -v" ,
581+ "ctestCommandArgs" : " " ,
582+ "inheritEnvironments" : [ " msvc_x86" ],
583+ "variables" : []
584+ },
585+ {
586+ "name" : " x86-Release" ,
587+ "generator" : " Ninja" ,
588+ "configurationType" : " RelWithDebInfo" ,
589+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
590+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
591+ "cmakeCommandArgs" : " " ,
592+ "buildCommandArgs" : " -v" ,
593+ "ctestCommandArgs" : " " ,
594+ "inheritEnvironments" : [ " msvc_x86" ],
595+ "variables" : []
596+ },
597+ {
598+ "name" : " x86-Clang-Debug" ,
599+ "generator" : " Ninja" ,
600+ "configurationType" : " Debug" ,
601+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
602+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
603+ "cmakeCommandArgs" : " " ,
604+ "buildCommandArgs" : " -v" ,
605+ "ctestCommandArgs" : " " ,
606+ "inheritEnvironments" : [ " clang_cl_x86" ],
607+ "variables" : []
608+ },
609+ {
610+ "name" : " x86-Clang-Release" ,
611+ "generator" : " Ninja" ,
612+ "configurationType" : " RelWithDebInfo" ,
613+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
614+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
615+ "cmakeCommandArgs" : " " ,
616+ "buildCommandArgs" : " -v" ,
617+ "ctestCommandArgs" : " " ,
618+ "inheritEnvironments" : [ " clang_cl_x86" ],
619+ "variables" : []
620+ },
621+ {
622+ "name" : " Existing Cache" ,
623+ "cacheRoot" : " " ,
624+ "inheritEnvironments" : [],
625+ "variables" : []
626+ },
627+ {
628+ "name" : " WSL-Debug" ,
629+ "generator" : " Unix Makefiles" ,
630+ "configurationType" : " Debug" ,
631+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
632+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
633+ "cmakeExecutable" : " /usr/bin/cmake" ,
634+ "cmakeCommandArgs" : " " ,
635+ "buildCommandArgs" : " " ,
636+ "ctestCommandArgs" : " " ,
637+ "inheritEnvironments" : [ " linux_x64" ],
638+ "wslPath" : " ${defaultWSLPath}" ,
639+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
640+ "variables" : []
641+ },
642+ {
643+ "name" : " WSL-Release" ,
644+ "generator" : " Unix Makefiles" ,
645+ "configurationType" : " RelWithDebInfo" ,
646+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
647+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
648+ "cmakeExecutable" : " /usr/bin/cmake" ,
649+ "cmakeCommandArgs" : " " ,
650+ "buildCommandArgs" : " " ,
651+ "ctestCommandArgs" : " " ,
652+ "inheritEnvironments" : [ " linux_x64" ],
653+ "wslPath" : " ${defaultWSLPath}" ,
654+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
655+ "variables" : []
656+ },
657+ {
658+ "name" : " WSL-Clang-Debug" ,
659+ "generator" : " Unix Makefiles" ,
660+ "configurationType" : " Debug" ,
661+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
662+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
663+ "cmakeExecutable" : " /usr/bin/cmake" ,
664+ "cmakeCommandArgs" : " " ,
665+ "buildCommandArgs" : " " ,
666+ "ctestCommandArgs" : " " ,
667+ "inheritEnvironments" : [ " linux_clang_x64" ],
668+ "wslPath" : " ${defaultWSLPath}" ,
669+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
670+ "variables" : []
671+ },
672+ {
673+ "name" : " WSL-Clang-Release" ,
674+ "generator" : " Unix Makefiles" ,
675+ "configurationType" : " RelWithDebInfo" ,
676+ "buildRoot" : " ${projectDir}\\ out\\ build\\ ${name}" ,
677+ "installRoot" : " ${projectDir}\\ out\\ install\\ ${name}" ,
678+ "cmakeExecutable" : " /usr/bin/cmake" ,
679+ "cmakeCommandArgs" : " " ,
680+ "buildCommandArgs" : " " ,
681+ "ctestCommandArgs" : " " ,
682+ "inheritEnvironments" : [ " linux_clang_x64" ],
683+ "wslPath" : " ${defaultWSLPath}" ,
684+ "addressSanitizerRuntimeFlags" : " detect_leaks=0" ,
685+ "variables" : []
686+ }
687+ ]
688+ }
689+ ```
340690
691+ ::: moniker-end
341692## See also
342693
343694[ CMake Projects in Visual Studio] ( cmake-projects-in-visual-studio.md ) <br />
0 commit comments