I think something changed recently…

According to almost everyone on the Internet, including the CMake documentation and command line help, to generate a 64-bit configuration for Visual Studio you just append Win64 to the generator name that you pass to the -g option on the command line. The problem is that this is wrong, at least using CMake 3.4 on Windows 7 to generate Visual Studio 2015 project files. Thankfully, I did come across a message in a mailing list archive that contained the answer: -A x64.

That will generate Visual Studio project files with a 64-bit configuration. There’s no way to generate project files that contain both 32 and 64 bit configurations using CMake. That’s probably for the best, in order to support both you’d need to be able to specify multiple library directories in one CMake invocation for things like Boost so that the different configurations can find the library files specific to 32 or 64 bit builds. Instead you need separate build directories to create the different configurations, each directory containing project files generated with a separate call to CMake. Similar to how one uses CMake to generate debug and release builds on Unix.

So this was mostly one of those I’m posting this so that the next time I google this problem I find this solution type of posts. Now, excuse me while I go add new answers to some Stack Overflow questions so I find the correct solution when they come up in google as well.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: