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

Author Topic: [SOLVED] Compiling CSFML 2.3 in Windows Revisited  (Read 5099 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
[SOLVED] Compiling CSFML 2.3 in Windows Revisited
« on: October 01, 2016, 06:20:55 pm »
I have a Windows 10 machine and I am trying to build CSFML 2.3.  I have loaded SFML 2.4, and so this is what I am referencing.  I took the FindSFML.cmake file out of the SFML Modules directory and I placed it in the CMake Modules directory.  So far, so good.  CMake finds SFML just fine.

However, I now have a problem locating the dependent DLLs.  Here is the message:
CMake Error at D:/apps/CMake/share/cmake-3.6/Modules/FindSFML.cmake:358 (message):
  SFML found but some of its dependencies are missing ( FreeType libjpeg
  OpenAL Ogg Vorbis VorbisFile VorbisEnc FLAC)
Call Stack (most recent call first):
  src/SFML/CMakeLists.txt:26 (find_package)

These libraries are located in my System32 directory.  Now, when I compile SFML via CodeBlocks, I add these dependencies to the linker settings, but I do not need to define their location.  Just the names.

So, in order for CMake to see these dependencies, what should I do?  Copy the DLLs somewhere?  Modify a CMake setting?  Download the SDKs for the missing dependencies?

I took a look at the FindSFML.cmake script and I noticed that the dependencies are found via a macro which uses the paths in the variable FIND_SFML_PATHS.  My thinking is that I could either copy the DLLs into one of the specified paths or add C:/Windows/System32 in the FIND_SFML_PATHS list.

Any and all help will be greatly appreciated.


Copying FindSFML.cmake to the ${CMAKE_ROOT}/share/cmake-3.6/Modules directory is the first step in getting CMake to successfully configure CSFML.

The second thing to do is modify the FindSFML.cmake file so it can find the SFML dependencies.

The version of SFML (source) I have is version 2.4.0.  I do not know about previous distributions, but in this distribution the dependencies are under ${SFML_ROOT}/extlibs.  The cmake file does not look here, so it had to be tweaked.  Here is the relevant snippet from the original code in FindSFML.cmake:

    macro(find_sfml_dependency output friendlyname)
        # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
        if(${${output}} STREQUAL "${output}-NOTFOUND")

The key part is the definition for PATH_SUFFIXES, which in the original file is assigned the value "lib".  By changing this to "extlibs", CMake finds everything just swell:


So, the CMake issue has been solved.  Now I will see what happens when I attempt to compile...
« Last Edit: October 02, 2016, 07:29:43 pm by astr0wiz »


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10605
    • View Profile
    • development blog
    • Email
Re: [SOLVED] Compiling CSFML 2.3 in Windows Revisited
« Reply #1 on: October 03, 2016, 12:36:13 pm »
The better way to go about this is to:

a) Run the INSTALL target when building SFML, so the correct dependencies and all of the SFML libraries get installed nicely into a directory.
b) Set CMAKE_MODULE_PREFIX to directory where the FindSFML.cmake is located.
c) Set SFML_ROOT to the directory where you installed SFML into and that contains SFML and its dependencies in the lib/ directory.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
Dev Blog: https://duerrenberger.dev/blog/