How to support both vcxproj to cmake on a project?

Visual StudioVisual Studio-2010MakefileCmakeGyp

Visual Studio Problem Overview


I'm developing cross-platform c++ project. The original idea is to work with msvc2010 and later compile for other systems with the help of CMake and Hudson. It doesn't seem to be convenient manually change CMake files after changes in studio settings.

So, what’s the easiest way: to write parser for vcxproj and vcxproj.filters, or there is another good solution?

Visual Studio Solutions


Solution 1 - Visual Studio

It might be useful, from time to time, to do this type of conversion, say for porting. On my travels I've found the following, in no particular order:

Specifically for VS to CMake/GYP:

  • vcproj2cmake
  • vcxproj2cmake (not a typo!)
  • gypify.py is a .sln/solution-reading Gyp file generator. Gyp is a Cmake alternative, currently being used by the Chromium project (base for Google's Chrome browser). Gyp will output Makefile, Visual Studio or XCode build files (see Gyp's '-f [make|scons|msvc|xcode]' switch). This Python script is quite promising, I'm hoping to modify it soon to correctly specify header-containing folders for gcc's '-I' include parameter.
  • Make It So Converts Visual Studio solutions to Linux gcc makefiles
  • sln2mak C# project
  • sln2mak Perl script
  • GUCEF Project includes the ProjectGenerator tool, for Cmake
  • gencmake (ruby) – KDE Project
  • 'pbtomake' says it can convert XCode xcodeproj/pbproj files to Makefiles (maybe outdated)

Cheers

Rich

Solution 2 - Visual Studio

You're coming at it backwards -- set up all your CMakeLists.txt and then generate the MSVC project from it.

It shouldn't be hard or time-consuming. Basically you just need to say which directories to look into, declare your include paths, collect your *.cpps for each library with a glob expression, and declare your dependencies.

If you have to set up anything else, then your project probably isn't very portable :-/

Solution 3 - Visual Studio

The best tool for this purprose is cmake-converter

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontikkereyView Question on Stackoverflow
Solution 1 - Visual StudioBig RichView Answer on Stackoverflow
Solution 2 - Visual StudiospraffView Answer on Stackoverflow
Solution 3 - Visual StudioPavel LiavonauView Answer on Stackoverflow