根据标题,CMake
无法通过s宏找到SFML
我使用 Microsoft 的vcpkg
工具安装的。CMake
find_package()
我已验证SFML
已安装在已vcpkg
安装目录 ( ~\vcpkg\installed\x86-windows
) 中。
此外,我还在文件vcpkg
中包含了工具链CMakeSettings.json
文件。
具体错误是:
CMake Error at ~\CMakeLists.txt:40 (find_package):
Could not find a package configuration file provided by "SFML" (requested
version 2.4.2) with any of the following names:
SFMLConfig.cmake
sfml-config.cmake
CMakeSettings.json
(简化 - 仅调试配置):
"name": "x86-Debug",
"generator": "Visual Studio 15 2017",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-m -v:minimal",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "C:\\Microsoft\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
}
]
CMakeLists.txt
(也简化):
cmake_minimum_required(VERSION 3.6)
project(Tempus)
add_subdirectory(src)
# Fails at this step
find_package(SFML 2.4.2 REQUIRED system window graphics)
include_directories(${SFML_INCLUDE_DIR})
add_executable(Tempus ${SRC})
target_link_libraries(Tempus ${SFML_LIBRARIES})
我不认为我错过了什么。SFML
提供了一个findSFML.cmake
应该vcpkg
通过工具链文件自行处理的内容(假设我已经正确理解了他们的文档)。我肯定错过了什么?