{"id":3380,"date":"2017-10-24T09:40:47","date_gmt":"2017-10-24T16:40:47","guid":{"rendered":"https:\/\/visualgdb.com\/w\/?p=3380"},"modified":"2017-10-24T09:40:47","modified_gmt":"2017-10-24T16:40:47","slug":"building-advanced-cmake-projects-with-team-foundation-server","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/ci\/tfs\/cmake\/","title":{"rendered":"Building Advanced CMake projects with Team Foundation Server"},"content":{"rendered":"<p>This tutorial shows how to use Team Foundation Server to build <a href=\"https:\/\/visualgdb.com\/tutorials\/linux\/cmake\/\">advanced CMake projects<\/a>. The advanced CMake project subsystem replaces the regular Visual C++ project subsystem and provides seamless integration with CMake. Instead of duplicating settings between the CMakeLists.txt files and the Visual Studio project files, the advanced CMake subsystem lets Visual Studio treat CMakeLists.txt files project files, automatically showing an updating targets, source files and build settings.<\/p>\n<p>In this tutorial we will create a basic project using the Advanced CMake Project System, check it in the TFS source control and will show how to setup a built agent to build this project without installing a Visual Studio instance there. This tutorial will use 2 machines: <strong>server<\/strong> machine running TFS and the build agent and the <strong>client<\/strong> machine running Visual Studio.<\/p>\n<p>Before you begin, install VisualGDB 5.3R4 or later and follow the <a href=\"https:\/\/visualgdb.com\/tutorials\/ci\/tfs\/make\/\">TFS Makefile tutorial<\/a> to get the basic TFS functionality to work.<\/p>\n<ol>\n<li>Start Visual Studio on the client machine and begin creating a new VisualGDB Linux Project in your TFS checkout directory:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/01-cmakeprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3381\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/01-cmakeprj.png\" alt=\"01-cmakeprj\" width=\"941\" height=\"653\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/01-cmakeprj.png 941w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/01-cmakeprj-300x208.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/01-cmakeprj-392x272.png 392w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/01-cmakeprj-130x90.png 130w\" sizes=\"(max-width: 941px) 100vw, 941px\" \/><\/a><\/li>\n<li>Select &#8220;Create a new project -&gt; Application -&gt; Use CMake -&gt; Use the advanced CMake project subsystem&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/02-advancedcm.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3382\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/02-advancedcm.png\" alt=\"02-advancedcm\" width=\"822\" height=\"662\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/02-advancedcm.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/02-advancedcm-300x242.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>The steps shown in this tutorial will generally work for both remotely built and locally built projects. However this tutorial will focus on using a cross-toolchain to build the code on the Windows machine. Select your cross-toolchain and the deployment computer and set the deployment folder. If you want to avoid deploying executables built by different users in the same directory, use the $(USERNAME) variable in the deployment folder:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/03-deploy.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3383\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/03-deploy.png\" alt=\"03-deploy\" width=\"822\" height=\"662\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/03-deploy.png 822w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/03-deploy-300x242.png 300w\" sizes=\"(max-width: 822px) 100vw, 822px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to create the project. Then add it to source control via Source Control -&gt; Add Solution to Source Control:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/04-addtosc.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3384\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/04-addtosc.png\" alt=\"04-addtosc\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/04-addtosc.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/04-addtosc-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/04-addtosc-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/04-addtosc-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Go to the Pending Changes view in the Team Explorer window to see the files reported by VisualGDB within the newly created project. Review the file list and click &#8220;Check in&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/05-checkin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3385\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/05-checkin.png\" alt=\"05-checkin\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/05-checkin.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/05-checkin-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/05-checkin-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/05-checkin-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Build the project on the Windows machine to ensure that no components are missing:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/06-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3386\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/06-build.png\" alt=\"06-build\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/06-build.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/06-build-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/06-build-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/06-build-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Now we will setup the automatic build on the build server using TFS. Open the TFS console, go to the &#8220;Build &amp; Release&#8221; tab and click &#8220;New Build -&gt; Empty Process&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/07-emptybuild.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3387\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/07-emptybuild.png\" alt=\"07-emptybuild\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/07-emptybuild.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/07-emptybuild-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/07-emptybuild-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/07-emptybuild-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Pick a name for the new build and click &#8220;Add Task&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/08-name.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3388\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/08-name.png\" alt=\"08-name\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/08-name.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/08-name-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/08-name-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/08-name-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Ensure you have the <a href=\"https:\/\/github.com\/sysprogs\/TFSIntegration\/releases\">VisualGDB TFS extension<\/a> installed and then add the &#8220;VisualGDB Build&#8221; task from the &#8220;Build&#8221; page:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/09-add.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3389\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/09-add.png\" alt=\"09-add\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/09-add.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/09-add-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/09-add-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/09-add-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Review the settings of the &#8220;VisualGDB Build&#8221; step. By default, VisualGDB will build all <strong>.vgdbcmake<\/strong> files in all subdirectories of your project and all .vgdbsettings files (corresponding to regular VisualGDB projects based on the .vcxproj files). Set the configuration name to &#8220;Release&#8221; as otherwise it will default to &#8220;Debug&#8221;:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/10-release.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3390\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/10-release.png\" alt=\"10-release\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/10-release.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/10-release-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/10-release-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/10-release-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Ensure you run a build agent on a machine with VisualGDB installed (see <a href=\"https:\/\/visualgdb.com\/tutorials\/ci\/tfs\/make\/\">this tutorial<\/a> for more details) and start the build. In this example the build will fail because the <strong>server<\/strong> is missing the Raspberry Pi toolchain used when creating the project:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/11-notoolchain.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3391\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/11-notoolchain.png\" alt=\"11-notoolchain\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/11-notoolchain.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/11-notoolchain-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/11-notoolchain-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/11-notoolchain-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>You can install the toolchain manually from <a href=\"http:\/\/gnutoolchains.com\/\">gnutoolchains.com<\/a> or configure VisualGDB to install it automatically via Team Settings (requires Custom edition). On the client machine click Tools-&gt;VisualGDB-&gt;Manage Team Settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/12-team.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3392\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/12-team.png\" alt=\"12-team\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/12-team.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/12-team-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/12-team-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/12-team-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Select a shared folder visible from both the <strong>client<\/strong> and the <strong>server<\/strong> that will be used to store shared settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/13-dir.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3393\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/13-dir.png\" alt=\"13-dir\" width=\"686\" height=\"493\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/13-dir.png 686w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/13-dir-300x216.png 300w\" sizes=\"(max-width: 686px) 100vw, 686px\" \/><\/a><\/li>\n<li>Go to the Packages tab and share your toolchain via team settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/14-rasp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3394\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/14-rasp.png\" alt=\"14-rasp\" width=\"686\" height=\"493\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/14-rasp.png 686w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/14-rasp-300x216.png 300w\" sizes=\"(max-width: 686px) 100vw, 686px\" \/><\/a><\/li>\n<li>Enter the path to the shared settings folder in the build task settings:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/15-teamsettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3395\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/15-teamsettings.png\" alt=\"15-teamsettings\" width=\"1231\" height=\"840\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/15-teamsettings.png 1231w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/15-teamsettings-300x205.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/15-teamsettings-1024x699.png 1024w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/15-teamsettings-130x90.png 130w\" sizes=\"(max-width: 1231px) 100vw, 1231px\" \/><\/a><\/li>\n<li>Run the build again. VisualGDB will begin synchronizing the team settings. It will automatically download and install the toolchain and CMake (if the build runs on the Windows machine):<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/16-update.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3396\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/16-update.png\" alt=\"16-update\" width=\"1366\" height=\"867\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/16-update.png 1366w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/16-update-300x190.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/16-update-1024x650.png 1024w\" sizes=\"(max-width: 1366px) 100vw, 1366px\" \/><\/a><\/li>\n<li>The initial build after installing the toolchain\/CMake might fail. In this case, simply restart it. The next build should succeed:<a href=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/17-buildok.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3397\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/17-buildok.png\" alt=\"17-buildok\" width=\"1366\" height=\"867\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/17-buildok.png 1366w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/17-buildok-300x190.png 300w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2017\/10\/17-buildok-1024x650.png 1024w\" sizes=\"(max-width: 1366px) 100vw, 1366px\" \/><\/a><\/li>\n<li><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to use Team Foundation Server to build advanced CMake projects. The advanced CMake project subsystem replaces<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149],"tags":[77,150],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/3380"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=3380"}],"version-history":[{"count":2,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/3380\/revisions"}],"predecessor-version":[{"id":3434,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/3380\/revisions\/3434"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=3380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=3380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=3380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}