1
General / Re: CMake in SFML 2.5
« on: June 08, 2018, 11:49:04 am »
So far I have tried using add_subdirectory() to generate the SFMLCmake.config file, and then using find_package(). (This looks very hacky to me...)
Cmake runs fine and SFML builds, but i still get linker errors:
add_subdirectory(${SRCDIR}/lib/SFML-2.5.0)
set(SFML_DIR ${BINDIR}/lib/SFML-2.5.0)
find_package (SFML 2.5 REQUIRED window graphics system)
set(SFML_DIR ${BINDIR}/lib/SFML-2.5.0)
find_package (SFML 2.5 REQUIRED window graphics system)
Cmake runs fine and SFML builds, but i still get linker errors:
<me> in ~/Desktop/tutorial-sfmlcmake/build
$ make
BINDIR/Users/<me>/Desktop/tutorial-sfmlcmake/build
SRCDIR/Users/<me>/Desktop/tutorial-sfmlcmake
-- Found SFML 2.5.0 in /Users/<me>/Desktop/tutorial-sfmlcmake/build/lib/SFML-2.5.0
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/<me>/Desktop/tutorial-sfmlcmake/build
[ 13%] Built target sfml-system
[ 46%] Built target sfml-window
[ 72%] Built target sfml-graphics
[ 73%] Linking CXX executable tutorialsfml
Undefined symbols for architecture x86_64:
"sf::String::String(char const*, std::locale const&)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [tutorialsfml] Error 1
make[1]: *** [CMakeFiles/tutorialsfml.dir/all] Error 2
make: *** [all] Error 2
$ make
BINDIR/Users/<me>/Desktop/tutorial-sfmlcmake/build
SRCDIR/Users/<me>/Desktop/tutorial-sfmlcmake
-- Found SFML 2.5.0 in /Users/<me>/Desktop/tutorial-sfmlcmake/build/lib/SFML-2.5.0
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/<me>/Desktop/tutorial-sfmlcmake/build
[ 13%] Built target sfml-system
[ 46%] Built target sfml-window
[ 72%] Built target sfml-graphics
[ 73%] Linking CXX executable tutorialsfml
Undefined symbols for architecture x86_64:
"sf::String::String(char const*, std::locale const&)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [tutorialsfml] Error 1
make[1]: *** [CMakeFiles/tutorialsfml.dir/all] Error 2
make: *** [all] Error 2