错误:
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:13 (find_package):
Could not find a package configuration file provided by "freetype" with any
of the following names:
freetypeConfig.cmake
freetype-config.cmake
Add the installation prefix of "freetype" to CMAKE_PREFIX_PATH or set
"freetype_DIR" to a directory containing one of the above files. If
"freetype" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
这是我的 CMakeLists.txt:
cmake_minimum_required(VERSION 3.19)
project(ogle VERSION 1.0.0
DESCRIPTION "Our first project"
LANGUAGES CXX)
set(CXX_STANDARD 20)
set(CXX_STANDARD true)
set(INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/include)
find_package(glfw3 CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(freetype CONFIG REQUIRED)
find_package(assimp CONFIG required)
add_executable(ogle /src/*.cpp ./*.cpp /src/*.c)
target_link_libraries(ogle PUBLIC glfw3::glfw3 glm::glm freetype::freetype PRIVATE assimp::assimp)
如何解决这个问题? Freetype 与所有其他内容位于同一目录中。这是图书馆的已知问题吗?
Freetype2 不附带 CMake 配置或模块。但它确实带有 pkg-config 配置文件,所以使用它: