SFML community forums

Help => General => Topic started by: Daniel on December 18, 2020, 07:22:22 pm

Title: Cross-platform project with CMake and SFML
Post by: Daniel 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...
Title: Re: Cross-platform project with CMake and SFML
Post by: eXpl0it3r 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.
Title: Re: Cross-platform project with CMake and SFML
Post by: Daniel 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! :)