2

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 中为用户手动设置选项。

4

1 回答 1

2

我通过CONFIGREQUIRED.

find_package(CURL REQUIRED CONFIG)
if(CURL_FOUND)
  include_directories(${CURL_INCLUDE_DIRS})
  target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
endif()
于 2014-10-29T15:28:30.377 回答