Generating Microsoft Visual Studio Project using CMake
Compiling C/C++ libraries with CMake for generating Visual Studio projects is a pain. Alot of times compiling with CMake goes wrong or doesn't work at all. The documentation for compilation is not adequate & doesn't cover most of the scenario's for different compiler options, which CMake uses to generate the project from the source code.
My experience with CMake wasn't good either. I tried to compile a library & got all sorts of weird errors in configuring & generating the project. However the following steps worked for me like a charm.
I am using Microsoft Visual Studio 2010 express, CMake 2.8 & Windows 7 however these settings should work on other versions of Windows & Visual Studios.
CMake won't work with Microsoft Visual Studio 2010 Ultimate Edition for some unknown reason.
My experience with CMake wasn't good either. I tried to compile a library & got all sorts of weird errors in configuring & generating the project. However the following steps worked for me like a charm.
I am using Microsoft Visual Studio 2010 express, CMake 2.8 & Windows 7 however these settings should work on other versions of Windows & Visual Studios.
CMake won't work with Microsoft Visual Studio 2010 Ultimate Edition for some unknown reason.
- Open CMake-GUI application.
- Locate the folder which contains CMakeLists.txt & set it as source directory.
- Create an output directory anywhere on your HDD, however the directory containing CMake binaries is preferred.
- Go to Visual Studio's project settings & set Incremental Linker: NO.
- Locate cvtres.exe file in visual studio directory & replace it with Visual Studio 2012 Ultimate edition's cvtres.exe.
- Click configure button in CMake-GUI application and leave the default radio button settings.
- Select Visual Studio 2010 from compilers list in configure window.
- Click generate.
- You are done !
Comments
Post a Comment