9

I am dealing with relatively big visual studio CPP project (we implemented this project from scratch in windows environment). Now, I have to compile this project in Linux environment. But, I have no idea How I can create a Cmake file from this visual studio project . Is there any straight forward solution?

Thank you

dustinos3
  • 934
  • 3
  • 17
  • 27
user1538653
  • 121
  • 1
  • 1
  • 10
  • 2
    I have tried automatic solutions but found its best to write the CMakeLists.txt yourself even for a large project. You may want to refactor the layout to be more compatible with CMake when doing so. – drescherjm Nov 28 '18 at 20:14
  • Is CMake essentail to you? If not you can use the Visual Sudio C++ for Linux add-on. You'll have to create a new MSBuild project for the Linux target but, while tedious, is simple and repetetive. You can share the source code. Some more info here : https://stackoverflow.com/questions/51151271/can-i-compile-a-dll-project-to-a-shared-object-so-file-for-arm/51271490#51271490 – stanthomas Dec 01 '18 at 20:54

2 Answers2

4

It would be a great tool if it was possible to convert MSVS project to cmake in Linux environment, but unfortunately I also didn't find such a tool.

However, you can convert VS solution to CMakeLists.txt. You can try this or that tools or some others, but then you need to redesign it.

mr NAE
  • 3,144
  • 1
  • 15
  • 35
-1

Use CMake Converter. This tool converts VS solutions to CMake projects. https://cmakeconverter.readthedocs.io/en/latest/use.html

Unfortunately, this solution is not ideal and could convert your project with some compilation issues, however, it could be a good platform to begin with. I successfully used it to convert a couple of very old MSBuild projects.

The same (not downvoted) answer here, if you'd like: https://stackoverflow.com/a/60226700/13292744

flm
  • 107
  • 8
  • I think the downvote may be because it isn't very clear how to run cmake-converter on Windows. Here is what I did:- 1. Make sure you have Python installed. 2. From an admin command prompt type:- "pip install cmake_converter" 3. To run cmake-converter I used the following on the command prompt:- "python c:\Python311\Lib\site-packages\cmake_converter\main.py -s " – user2284063 May 02 '23 at 12:53
  • 1
    @user2284063 What are you talking about? Installation instructions are on the project page, by the link which I explicitly provided ("Install CMake Converter" section) – flm May 17 '23 at 10:52