我正在使用find_package
来查找项目所需的依赖项,如下所示:
find_package(CURL REQUIRED)
if(CURL_FOUND)
include_directories(${CURL_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
endif()
但是,我想知道当find_package
失败时,如何在cmake-gui中手动设置用户选项。
答案 0 :(得分:2)
我将CONFIG
放在REQUIRED
之后解决了问题。
find_package(CURL REQUIRED CONFIG)
if(CURL_FOUND)
include_directories(${CURL_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
endif()