当find_package找不到库时,在cmake-gui中选择路径

时间:2014-10-29 12:25:25

标签: cmake cmake-gui

我正在使用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中手动设置用户选项。

1 个答案:

答案 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()