Hi!
I’m trying to compile a lib using SFML, so I put this SFML code :
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/Modules/FindSFML.cmake)
set(INCROOT ${PROJECT_SOURCE_DIR}/include/odfaeg/Core)
set(SRCROOT ${PROJECT_SOURCE_DIR}/src/odfaeg/Core)
set(SRC
${INCROOT}/archive.h
${SRCROOT}/archive.cpp
${INCROOT}/serialization.h
${INCROOT}/entityFactory.hpp
${INCROOT}/ecs.hpp
${INCROOT}/erreur.h
${INCROOT}/export.hpp
${SRCROOT}/erreur.cpp
${INCROOT}/resourceManager.h
${INCROOT}/any.h
${INCROOT}/resourceCache.h
${INCROOT}/utilities.h
${SRCROOT}/utilities.cpp
${INCROOT}/factory.h
${INCROOT}/factory.cpp
${INCROOT}/entitySystem.h
${INCROOT}/timer.h
${INCROOT}/state.h
${SRCROOT}/state.cpp
${INCROOT}/stateGroup.h
${SRCROOT}/stateGroup.cpp
${INCROOT}/stateStack.h
${SRCROOT}/stateStack.cpp
${INCROOT}/stateParameter.h
${INCROOT}/stateParameterBase.h
${INCROOT}/stateExecutor.h
${INCROOT}/archive.h
${INCROOT}/time.h
${SRCROOT}/time.cpp
${INCROOT}/clock.h
${SRCROOT}/clock.cpp
${INCROOT}/variant.h
${INCROOT}/class.hpp
${SRCROOT}/class.cpp
${INCROOT}/constructor.hpp
${SRCROOT}/constructor.cpp
${INCROOT}/memberFunction.hpp
${SRCROOT}/memberFunction.cpp
${INCROOT}/runtimeCompiler.hpp
${SRCROOT}/runtimeCompiler.cpp
${INCROOT}/fastDelegate.h
${INCROOT}/ecs.hpp
)
include_directories(${CMAKE_INCLUDE_PATH})
link_directories(${CMAKE_LIBRARY_PATH})
find_package(SFML 2 REQUIRED audio network graphics window system)
sfgl_add_library(odfaeg-core
SOURCES ${SRC})
target_link_libraries (odfaeg-core ${SFML_LIBRARIES})
odfaeg-core is linked but cmake dosn’t link SFML_LIBRARIES.
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj): in function `operator()':
C:/Users/Laurent et Christian/ODFAEG-master/ODFAEG/src/odfaeg/Math/distribution.cpp:77:(.text+0xd2): undefined reference to `__imp__ZN2sf7secondsEf'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj): in function `odfaeg::math::Distributions::uniform(sf::Time, sf::Time)':
C:/Users/Laurent et Christian/ODFAEG-master/ODFAEG/src/odfaeg/Math/distribution.cpp:70:(.text+0x103): undefined reference to `__imp__ZN2sfleENS_4TimeES0_'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Laurent et Christian/ODFAEG-master/ODFAEG/src/odfaeg/Math/distribution.cpp:72:(.text+0x13a): undefined reference to `__imp__ZNK2sf4Time9asSecondsEv'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/Laurent et Christian/ODFAEG-master/ODFAEG/src/odfaeg/Math/distribution.cpp:73:(.text+0x151): undefined reference to `__imp__ZNK2sf4Time9asSecondsEv'
C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\odfaeg-math.dir/objects.a(distribution.cpp.obj): in function `operator()':
C:/Users/Laurent et Christian/ODFAEG-master/ODFAEG/src/odfaeg/Math/distribution.cpp:120:(.text+0x6bc): undefined reference to `__imp__ZN2sf5ColorC1Ev'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [src\odfaeg\Math\CMakeFiles\odfaeg-math.dir\build.make:273: lib/libodfaeg-math-d.dll] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:317: src/odfaeg/Math/CMakeFiles/odfaeg-math.dir/all] Error 2
mingw32-make: *** [makefile:135: all] Error 2
I get this errors when I want to build my lib in shared mode.
Thanks.