Monday 13 July 2015

Multi-platform CMake

The latest CMake 3.3 allows you to separately specify the generator (i.e. what compiler to make projects for) and the platform, using the -G and -A command line parameters respectively. That's especially good for Visual Studio, as you can do something like this:

cmake -G "Visual Studio 11 2012" -A x64 -D CMAKE_MAKE_PROGRAM=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe "C:workspace\source_dir"

 Even better, the -A switch recognizes "x64" as a platform, even though the generator is officially called "Visual Studio 11 2012 Win64". So that will play nicely with environment variables, e.g.
SET PLATFORM=x64

No comments:

Post a Comment