2

When I used GTest library on CMake, I could use GTEST_ROOT for finding root path of GTest. However, I cannot use CURL_ROOT to use curl, because FindCURL.cmake doesn't get the variable.

How can I do?

LeeGom
  • 201
  • 3
  • 10
  • 2
    You may set `CMAKE_PREFIX_PATH` variable. See also [this question](http://stackoverflow.com/questions/34795816/hinting-findname-cmake-files-with-a-custom-directory). – Tsyvarev Jan 16 '16 at 13:30
  • @Tsyvarev Thank you! I'll post answer that based on your advice. – LeeGom Jan 17 '16 at 08:36

1 Answers1

1

Use CMAKE_PREFIX_PATH variable. Also you may use semicolon(;) with multiple paths.

On script:

set (CMAKE_PREFIX_PATH C:/Libraries/gtest;C:/Libraries/curl)

find_package (GTest REQUIRED)
include_directories (${GTEST_INCLUDE_DIRS})
find_package (CURL REQUIRED)
include_directories (${CURL_INCLUDE_DIRS})

On console: cmake .. -DCMAKE_PREFIX_PATH=C:/Libraries/gtest;C:/Libraries/curl

LeeGom
  • 201
  • 3
  • 10