我有一个具有以下结构的项目:
projectName-master/
data/
source/
thirdparty/ (here is placed FindSFML.cmake file)
.gitignore
CMakeLists.txt
README.md
SOURCES.md
TODO.md
我使用CMake 2.8.11.1(cmake-gui)生成visual studio sln文件。路径以这种方式设置:
接下来我选择:配置 - > "为此项目指定生成器= Visual Studio 11,使用默认本机编译器" - >完成
然后我得到一个信息:配置过程出错,项目文件可能无效
CMake Gui包含以下信息:
名称: CMAKE_INSTALL_PREFIX 值 C:/ Program Files(x86)/ projectName 名称: SFML_INCLUDE_DIR 值 SFML_INCLUDE_DIR-NOTFOUND
CMake Error at thirdparty/FindSFML.cmake:165 (message):
Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY
SFML_AUDIO_LIBRARY SFML_NETWORK_LIBRARY SFML_GRAPHICS_LIBRARY)
Call Stack (most recent call first):
CMakeLists.txt:63 (find_package)
我下载了SFML并设置了SFML_INCLUDE_DIR(在CMake Gui中):C:/OpenGL/SFML-2.1/include/SFML但我仍然遇到了这个错误。 2.如何解决这个问题? lib文件和DLL怎么样?
EDIT1: 我从official site
下载了SFML项目中的FindSFML.cmake不包含任何SFML_ROOT条目,但SFML_INCLUDE_DIR如下所示:
# find the SFML include directory
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
PATH_SUFFIXES include
PATHS
${SFMLDIR}
$ENV{SFMLDIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/)
那么如何设置SFML_ROOT?我是否需要在该文件中添加一些条目(记录)?它会是什么样子的?
Edit2:新的FindSFML.cmake的一部分,带有SFML的路径(C:/OpenGL/SFML-2.1 /)
find_path(SFML_INCLUDE_DIR SFML/Config.hpp
PATH_SUFFIXES include
PATHS
${SFML_ROOT}
$ENV{SFML_ROOT}
C:/OpenGL/SFML-2.1/
~/Library/Frameworks
/Library/Frameworks
/usr/local/
/usr/
/sw # Fink
/opt/local/ # DarwinPorts
/opt/csw/ # Blastwave
/opt/)
答案 0 :(得分:1)
首先,SFML
不是CMake标准模块,因此提供源代码链接会很不错。我希望你的意思是this product。看一下FindSFML文件:
# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
# to tell CMake where SFML is.
因此,您可能只需要设置SFML_ROOT
变量,而不是SFML_INCLUDE_DIR
。
lib文件和dll是什么?
我认为这可能会有所帮助:
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
我可以选择其他目录,也可以将其设置为包含源文件的目录:h,cpp等。