Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to converted from a cmake project to a Visual studio project  (Read 390 times)

0 Members and 1 Guest are viewing this topic.

umaruchan

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
How to converted from a cmake project to a Visual studio project
« on: December 10, 2024, 07:34:29 am »
Hi

I want to include all SFML source codes in my project solution.
But when I downloaded the source package of SFML 2.5.1, I got the cmake project. (I never knew what cmake was before.)

I tried several methods to convert it to a Visual Studio project but did not succeed.
- I tried to open the SFML folder with VS, it can read cmake and generate something similar to a project but it does not allow me to add my game project to it.
- I try to use the cmake command
[cmake -G "Visual Studio 17 2022"]
It can generate VS projects.
But inside the vcxproj file has a lot of "hard code paths" such as "c:/SFML" which is not working for me.

In summary, is there any easy way to convert cmake project to vs project? (Same as the old day when it is SFML 1.6.)

Please give some advice to me. Thanks

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11049
    • View Profile
    • development blog
    • Email
Re: How to converted from a cmake project to a Visual studio project
« Reply #1 on: December 10, 2024, 10:09:02 am »
In theory you can use the source files as is, but you'll need to define all the necessary macros that CMake would set depending on the OS, architecture, etc.

VS projects always use "hard code paths". If you want the source to be somewhere else, you'd need to have it somewhere other than C:/SFML.

Personally, I'd recommend to use the SFML CMake Template, which integrates SFML as well, but you're working with a CMake project and the generated project files resemble your code base, while SFML is included without being overly noticeable.
While we've made sure to not do any CMake code generation, so the source could be used independently, we aren't actively supporting the inclusion of the SFML source in a project. Meaning, it's possible, but you'll have to figure out all the flags that are necessary to be set.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything