Mateusz Loskot :: hacking on, working out, living up

Quick fix for CMake broken Visual Studio 11 .sln

24 Nov 2011 | mloskot

Current CMake 2.8.6 generates broken .sln files for Visual Studio 11 Developer Preview. The bug has been fixed already in CMake upstream.

Meanwhile, I have become annoyed by manually fixing the solution files. Here is quick .bat script I call from my cmake-{project}.bat proxy scripts I maintain for every project configured with CMake. So the fix is applied automatically every time I run CMake:

@echo off
REM Fix broken Visual Studio 11 .sln generated by CMake 2.8.6 (or earlier)
set SED="C:\Program Files (x86)\GnuWin32\bin\sed.exe"
set SLN=%1
copy %SLN% %SLN%.copy
%SED% "s/Studio 2011/Studio 11/g" %SLN%.copy > %SLN%
del /Q %SLN%.copy
Fork me on GitHub