MantisBT - CMake
View Issue Details
0015926CMakeCMakepublic2016-01-19 08:522016-06-10 14:21
Lars Kühne 
Nils Gladitz 
normalminoralways
closedno change required 
x86_64CentOS7
CMake 3.4.1 
 
0015926: FindCURL.cmake exposed variables are empty
The FindCURL.cmake module exposes variables CURL_INCLUDE_DIRS and CURL_LIBRARIES, among others. These variables are empty, even though CURL_FOUND is true. Internally, the FindCURL.cmake script uses CURL_INCLUDE_DIR and CURL_LIBRARY variables. These are set correctly to the found locations on my system. Using these instead of the variables documented in the reference and at the beginning of the script works.
find_package(CURL REQUIRED)

message(CURL_FOUND) # true on my system

message(${CURL_INCLUDE_DIRS}) # this fails
message(${CURL_LIBRARIES}) # this too

message(${CURL_INCLUDE_DIR}) # this works
message(${CURL_LIBRARY}) # this too
No tags attached.
Issue History
2016-01-19 08:52Lars KühneNew Issue
2016-01-19 09:08Nils GladitzNote Added: 0040256
2016-01-19 09:31Lars KühneNote Added: 0040257
2016-01-19 09:38Nils GladitzStatusnew => resolved
2016-01-19 09:38Nils GladitzResolutionopen => no change required
2016-01-19 09:38Nils GladitzAssigned To => Nils Gladitz
2016-06-10 14:21Kitware RobotNote Added: 0041286
2016-06-10 14:21Kitware RobotStatusresolved => closed

Notes
(0040256)
Nils Gladitz   
2016-01-19 09:08   
When I try your test case on my Ubuntu system I get the following output (CMake 3.4.1):

  CURL_FOUND
  /usr/include
  /usr/lib/x86_64-linux-gnu/libcurl.so
  /usr/include
  /usr/lib/x86_64-linux-gnu/libcurl.so

Your first message() call outputs the string "CURL_FOUND" not the content
of the CURL_FOUND variable; beyond that the output looks as expected.

I can't tell where it might be failing for you but perhaps the FindCURL.cmake relevant output from cmake in --trace mode would help narrow it down.
(0040257)
Lars Kühne   
2016-01-19 09:31   
I should have written ${CURL_FOUND}. It was a typo, but its value is "true".

Shame on me: the problem is not in FindCURL.cmake, but more likely in this https://github.com/watchedit/CMakeModules/blob/master/FindJansson.cmake [^]
script I used in my project too. When executing this script BEFORE I call find_package(CURL), the mentioned variables are empty. When calling find_package(CURL) first, everything is set as expected. I'm not a CMake expert, so I don't understand why. Reversing the order of the calls in this case worked for me.

Thanks for your help, and sorry for the noise. Issue can be closed.
(0041286)
Kitware Robot   
2016-06-10 14:21   
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.