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?
Note: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.
Update: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
find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
if(${${output}} STREQUAL "${output}-NOTFOUND")
unset(output)
set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
endif()
endmacro()
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:
find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES extlibs NO_SYSTEM_ENVIRONMENT_PATH)
----------------------------------------------------------------------------^^^^^^^----------------------------
So, the CMake issue has been solved. Now I will see what happens when I attempt to compile...