Alex
Alex

Reputation: 3381

Choose path in cmake-gui when find_package doesn't find the library

I'm using find_package to find the dependencies that I need for my project, as follows:

find_package(CURL REQUIRED)
if(CURL_FOUND)
  include_directories(${CURL_INCLUDE_DIRS})
  target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
endif()

But, I would like to know how I can give the option for the user set manually in the cmake-gui when find_package fails.

Upvotes: 2

Views: 405

Answers (1)

Alex
Alex

Reputation: 3381

I solved the problem by putting CONFIG after the REQUIRED.

find_package(CURL REQUIRED CONFIG)
if(CURL_FOUND)
  include_directories(${CURL_INCLUDE_DIRS})
  target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
endif()

Upvotes: 2

Related Questions