Set the location of the TGUI directory, set the build directory (usually a new empty folder) and press "Configure".
Next select your generator, when using CodeBlocks this is "CodeBlocks - MinGW Makefiles". Just keep the "Use default native compilers" option checked and ignore the other three options.
If SFML cannot be found automatically you will receive an error.
If SFML was not found then you should set SFML_DIR to the folder containing SFMLConfig.cmake (SFML >= 2.5) or alternatively set the SFML_ROOT variable to the root SFML folder (the directory that contains the include and lib folders). If you use SFML_ROOT when you compiled sfml yourself then you will have to watch out for two things:
You can now configure the settings. Set the CMAKE_BUILD_TYPE option either to "Debug" or to "Release" depending on the type of library you want. You should also look at the TGUI_SHARED_LIBS option, check it to build dynamic libraries (.dll files), uncheck it to build static libraries. This option has to match with the one chosen for SFML.
After setting the options like you want them you need to press Configure again. Now you should have reached the message "Configuring done" at the bottom. All you have to do now is press Generate.
You are not done yet. CMake created a CodeBlocks project in the build directory that has to be build first.
Open the tgui.cbp file and hit "Build" to build the TGUI libraries.
Once this is done, you will find the libraries inside the lib subdirectory of the build folder. To make it easier to use tgui in your project, you should probably copy the .a (and .dll) files to a new "lib" folder in the TGUI root directory.
Open the “Project build options”.
On the left side you can choose whether you want to change debug or release target settings. Or you can just click on the name of your project (here TGUI-Test) to set them for both. TGUI requires C++11, so check the “-std=c++11” option.
In the “Search directories” of the “Compiler” add the path to the include directory.
In the “Search directories” of the “Linker” add the path to the lib directory (or wherever you placed the library that you build with cmake).
In “Linker settings” under “Other linker options” add ‘-ltgui’ in the ‘Release’ settings and/or add ‘-ltgui-d’ in the ‘Debug’ settings. When linking statically, you have to use ‘-ltgui-s’ and ‘-ltgui-s-d’ instead of course. Also note that the order has to be correct: first tgui, then the libraries from sfml.
When using shared libraries, don't forget to copy tgui.dll to your project’s folder.
You should now be able to use TGUI.