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

Author Topic: Cross-platform project with CMake and SFML  (Read 2283 times)

0 Members and 2 Guests are viewing this topic.

Daniel

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Cross-platform project with CMake and SFML
« on: December 18, 2020, 07:22:22 pm »
Hello!

I am trying to make a cross-platform project with CMake and SFML.

The project works fine if I build it for Visual Studio 2019 32bit because I have SFML for 32bit.

I also want to build the project using MinGW makefiles on windows with Git bash and on Linux as well.

My problem is that when I build the project using MinGW64 on Windows or Linux I get a bunch of warnings when the object files are built and some errors at the end when linking happens (See below).

I have provided the output when trying to build the project using MinGW and the CMakeLists.txt
I used the following script when building on git:
mkdir build
cd build
cmake .. -G "MinGW Makefiles"
make

How can I compile the project using MinGW makefiles?
How to make a proper CMakeLists for cross-platform?
How to build the project properly?

Update*
I modified the cmakelists just a bit, but it still doesn't make a big differenece...
« Last Edit: December 25, 2020, 02:19:48 am by binary1248 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Cross-platform project with CMake and SFML
« Reply #1 on: January 03, 2021, 02:12:35 pm »
Have you built SFML yourself with your MinGW64 version?
Or are you using the exact same MinGW64 version, as linked on the SFML download page?

The link_directories() and include_directories() are not needed, since the CMake config will provide this information with the link targets.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Daniel

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Cross-platform project with CMake and SFML
« Reply #2 on: January 03, 2021, 05:16:19 pm »
I was using the wrong version of MinGW :)) That's fixed now. Thank you for your tips! :)

 

anything