How to use cmake to generate Visual Studio .sln and .vcxproj

Hi,

I am new to this forum, so an Hello to all of you.

My problem:

I try to generate VS .sln and .vcxproj files from existing cmake files using cmake. So i will be able to use VS without cmake.

But do not know how.

The examples i found are the other way around. From VS to cmake, this is not what i am looking for.

Any idea is very helpful.

Thanks in advance.

cua
michael

cmake -B Builds -G 'Visual Studio 17 2022'

If I understand what you want in the end, CMake’s generated build systems still require CMake (at least to regenerate it if it changes). Additionally, CMake’s generated files are anchored to the absolute path used and is not relocatable.

Thank you very much. I’ll try that and let you know what happened.

Thanks for the answer:

my goal is: getting the VS project files to use within VS but without cmakes txt files. I want to have a clean VS environment.

cu

Why do you want to get VS files without cmake? And how exactly do you envision cmake helping you with that…? :thinking:

You can just create a VS project file by hand and not use cmake. Not sure why you’d want to do that, though.

Well,

I use an Open source Project, which has Many Modules and include Files(> 200).
I added my own Code, so the project has grown by a Factor of 3.

Every time the open source project ist modified by its developer, i have to
merge my version with the developers.

Cu
Michael

Well, that’s part of being a fork. I would recommend working with upstream to help contribute the build system you’re using or accept that things are going to be different and have this updating on the task list for every rebase/merge.

Well,

the project is in use within our company. over 1000 users are using it. The contracts of our company with the customers let us not freeze the project at a special point. We have to manage every change of the origin code to be up to date.

cu

Hello
I also encountered the same problem,
I tried to use scripts to change the absolute paths in the sln and vcxproj files generated by cmake to relative paths, but it was still not fully satisfied,
did you solve it?