我是C++和cmake的新手。我通過端口安裝了開羅庫,編寫爲here。現在我想包括開羅到我的項目。我編寫了CmakeLists.txt命令,如here所示。開羅圖書館和Cmake
cmake_minimum_required(VERSION 3.6)
project(HelloOpenGL)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
add_executable(HelloOpenGL ${SOURCE_FILES})
#find_package(ImageMagick COMPONENTS Magick++)
#include_directories(${ImageMagick_INCLUDE_DIRS})
#target_link_libraries(HelloOpenGL ${ImageMagick_LIBRARIES})
find_package(Cairo)
include_directories(${Cairo_INCLUDE_DIRS})
target_link_libraries(HelloOpenGL ${Cairo_LIBRARIES})
if(CAIRO_FOUND)
message("Cairo found")
else()
message("Cairo not found")
endif()
但它不工作,我得到這個輸出 -
CMake Warning at CMakeLists.txt:16 (find_package):
By not providing "FindCairo.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Cairo", but
CMake did not find one.
Could not find a package configuration file provided by "Cairo" with any of
the following names:
CairoConfig.cmake
cairo-config.cmake
Add the installation prefix of "Cairo" to CMAKE_PREFIX_PATH or set
"Cairo_DIR" to a directory containing one of the above files. If "Cairo"
provides a separate development package or SDK, be sure it has been
installed.
幫助我正確地包括開羅,請
您正在使用哪個版本的CMake? – fedepad