我正在尝试使用C++将SFML链接到一个CMake项目。这个设置在我的Linux机器上运行得很好,但是当我尝试在我的mac上构建时,它找不到库:ld: library not found for -lsfml-network。在这两台机器上,我对SFML的安装是完全相同的(以我的方式)。
我的CMakeLists.txt链接如下:
target_link_libraries( Playground ${OpenCV_LIBS} sfml-network sfml-window sfml-graphics sfml-system )
发布于 2018-03-09 20:14:14
SFML有一个关于如何使用CMake编译的教程。它提供了一个FindSFML.cmake文件,因此您可以简单地使用find_package和target_link_libraries
find_package(SFML REQUIRED COMPONENTS network window graphics system)
# ...
target_link_libraries(Playground
${SFML_LIBRARIES}
# If SFML did it correctly, this shouldn't be needed, but I can't tell from the
# documentation if they did:
${SFML_DEPENDENCIES}
)https://stackoverflow.com/questions/49201207
复制相似问题