SFML community forums

Help => General => Topic started by: Kian on May 03, 2013, 04:22:46 pm

Title: Building multiple targets for MingW with CMake
Post by: Kian on May 03, 2013, 04:22:46 pm
Hi, I was wondering if it is possible to crate a makefile that will build Release and Debug versions of SFML with CMake.

What I'm doing now is load CMake, set target to Release, Configure, Generate, then run mingw32-make install, then go back to CMake, set the target to Debug, and repeat. I was wondering if there was some target that automatically built both versions.

Thanks.
Title: Re: Building multiple targets for MingW with CMake
Post by: eXpl0it3r on May 03, 2013, 04:27:43 pm
You can create batch/shell script, that does this automatically, but CMake itself doesn't offer such options afaik. ;)
Title: Re: Building multiple targets for MingW with CMake
Post by: Laurent on May 03, 2013, 05:22:35 pm
Keep each build configuration in a separate folder, there's no need to overwrite the same one again and again.
Title: Re: Building multiple targets for MingW with CMake
Post by: Kian on May 03, 2013, 11:22:43 pm
Ah, right. The not-dumb way of doing it. Should have thought of it before :) And a batch file automates the rest of the process.

I just need to add a script to check the repository for updates, download changes, and build everything.
Title: Re: Building multiple targets for MingW with CMake
Post by: Kian on May 03, 2013, 11:56:18 pm
Quick additional question!

The tutorial didn't make it clear for me. If I want to create the static version of the libraries with cmake, do I just need to turn off the "BUILD_SHARED_LIBS" variable, or do I also have to select "SFML_USE_STATIC_STD_LIBS"? I understand I can't have both on at the same time, I'm just not sure if the second one is actually necessary for building the static library.
Title: Re: Building multiple targets for MingW with CMake
Post by: eXpl0it3r on May 04, 2013, 12:30:03 am
BUILD_SHARED_LIBS decides whether the library is build shared or static.
SFML_USE_STATIC_STD_LIBS decides whether SFML links against the runtime library shared or static.

It doesn't make sense to link against the runtime libraries statically, while building shared libraries, thus you're not given that option.
If you link the runtime libraries shared, then you'll have to provide the needed shared libs (e.g. for Visual Studio this would be the redistribution thingy, or for MinGW that would be libgcc and libstd).