CMake workaround for VS2017
Incredibuild doesn't yet support the new CMake feature in Visual Studio 2017, so below is a general command line workaround that will let you take advantage of the new feature.
For the sake of this demonstration, you can use a CMake sample project, which is located here:https://www.codeproject.com/Articles/1181455/A-CMake-tutorial-for-Visual-Cplusplus-developers
What is applicable to this sample project will also be applicable to your CMake files and solutions
Generation:
-
After downloading the project, copy all files to the same folder.
-
Load in the relevant project folder to Visual Studio. CMake will auto-generate a new file, which we will need to copy the CMake output in Visual Studio.
-
The following command was automatically generated in the directory shown by the CMake output.C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\CMake.exe" -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\Beelal\CMakeBuilds\4ad98d3d-1ddb-bf3a-b858-3709d1a407c1\build\x86-Debug\install" -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MAKE_PROGRAM="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja\ninja.exe" "C:\Users\Beelal\Desktop\cmakedemo\cmakedemo\src- Save the command as "generation_command.bat"
-
Next, to get this command to work with Incredibuild I needed to first create an XML profile and a second build command that included the automatically generated command.
-
Now we, in a sense, "wrap" the original command with Incredibuild by using the following commands:
-
"ibconsole /command="generation_command.bat" /profile="profile.xml" /openmonitor"
-
You can create a batch file command ib_command.bat so you don't need to manually type in the command again.
-
-
Performing the above steps will trigger Incredibuild to generate the relevant Solution.
Building the solution:
-
After generating the solution done by completing the steps above, you can now build the solution with Incredibuild's acceleration.
-
The following command was used for the project located under C:\Users\Beelal\CMakeBuilds\4ad98d3d-1ddb-bf3a-b858-3709d1a407c1:
-
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\CMake.exe" --build "C:\Users\Beelal\CMakeBuilds\4ad98d3d-1ddb-bf3a-b858-3709d1a407c1\install\x86-Debug" --clean-first -- "-v"
-
Save the command as build_command.bat
-
-
To Build with Incredibuild, now all you have to do is use the following command:
-
buildconsole /command="build_command.bat"
-
-
Now your CMake solution should successfully build with Incredibuild enabled.