When I tried to compile Thor with MinGW, I got linker errors in one of SFML's dependencies. Some symbols from libjpeg were not found.
Debugging showed me that during the CMake configuration step, a wrong libjpeg path is found:
find_package(SFML 2 COMPONENTS audio graphics window system)
message(STATUS "Dep: ${SFML_DEPENDENCIES}")
Dep: ... C:/Program Files (x86)/Java/jre7/bin/jpeg.dll ...
Why does it even find a .dll and not a .lib file? These arguments are supposed to be passed to
target_link_libraries in order to be
linked (not loaded at runtime like DLLs).
Investigating FindSFML.cmake shows that the call to
find_library (through the macro
find_sfml_dependency) already returns this wrong path... Which is strange since the library path appears first in the list, and I made sure libjpeg.a is there.
Debugging output used in FindSFML.cmake inside
find_sfml_dependency:
message("\nFinding ${output} (${ARGN}) in ${FIND_SFML_PATHS}")
message(" -> ${${output}}")
Finding JPEG_LIBRARY (jpeg) in C:/C++Libs/mingw;~/Library/Frameworks;/Library/Frameworks;/usr/local;/usr;/sw;/opt/local;/opt/csw;/opt
-> C:/Program Files (x86)/Java/jre7/bin/jpeg.dll
There
is a file C
:/C++Libs/mingw/lib/libjpeg.a, but somehow it's not recognized.
Strangely, the NMake toolchain works fine.
By the way, why does SFML not ship a FindJPEG.cmake module?