How to Make cURL works with cmake
2014-08-24 10:27
399 查看
How to Make cURL works with cmake
Recently, I want to learn cURL, so downloaded it and compiled it, and use
cmake to manage the project, I wrote a CMakelists.txt as below:
But it did not work, and cmake reported that it can not find cURL, I met
this situation before, so I set the environment variable for cmake like this:
set LIBCURL_ROOT= "cURL's path"
But it did not work neither, and I was confused, what was wrong with me, and
how could I make it works?
So I configured the environment variable CPLUS_INCLUDE_PATH to libcurl's
path, it did not work neither.
Finally, I open the file FindCURL.cmake and check content, I found that the
content didn't point the path of libcurl out, so I modified sentence in
FindCURL.cmake:
to
and the sentece in FindCURL.cmake
to
and run:
cmkae .. -G "MinGW Makefiles", it worked.
The conclution:
1. don't trust the libraries so much.
2. think more.
Recently, I want to learn cURL, so downloaded it and compiled it, and use
cmake to manage the project, I wrote a CMakelists.txt as below:
cmake_minimum_required(VERSION 2.8) project(curlTest) find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIR}) set(sources appMain.cpp) add_executable(curlTest ${sources}) target_link_libraries(curlTest ${CURL_LIBRIRIES})
But it did not work, and cmake reported that it can not find cURL, I met
this situation before, so I set the environment variable for cmake like this:
set LIBCURL_ROOT= "cURL's path"
But it did not work neither, and I was confused, what was wrong with me, and
how could I make it works?
So I configured the environment variable CPLUS_INCLUDE_PATH to libcurl's
path, it did not work neither.
Finally, I open the file FindCURL.cmake and check content, I found that the
content didn't point the path of libcurl out, so I modified sentence in
FindCURL.cmake:
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
to
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h PATHS $ENV{LIBCURL_ROOT}/include)
and the sentece in FindCURL.cmake
find_library(CURL_LIBRARY NAMES curl # Windows MSVC prebuilts: curllib libcurl_imp curllib_static # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): libcurl)
to
and run:
cmkae .. -G "MinGW Makefiles", it worked.
The conclution:
1. don't trust the libraries so much.
2. think more.
相关文章推荐
- How to Make an iOS VoIP App With Pjsip: Part 4
- Magical Record: how to make programming with Core Data pleasant
- How to make sexy buttons with CSS
- [How to] Make custom search with Nutch(v 1.0)?(转)
- 网易云课堂 - Class Two and Three - How to make your works professional.
- How to Make an HTTP Connection Using TCP/IP with RSocket
- How to Make an iOS VoIP App With Pjsip: Part 3
- How to Make an HTTP Connection Using TCP/IP with RSocket
- How To Make A Simple Multiplayer Game with Game Center Tutorial: Part 1/2
- iphone游戏开发-Collisions and Collectables: How To Make a Tile Based Game with Cocos2D Part 2
- How to Make an HTTP Connection Using TCP/IP with RSocket
- HOWTO make ns-3 interact with the real world
- How to make sexy buttons with CSS
- How to Make a AutoBuild System with Git Server
- How to Make an iOS VoIP App With Pjsip: Part 1
- How to Make a VR Game With Unity and Google Cardboard
- How To Make a Simple iPhone Game with Flash CS5
- raywenderlich-Rotating Turrets: How To Make A Simple iPhone Game with Cocos2D Part 2
- How to make Office VBA code interact with a VSTO application-level add-in
- How to Make an iOS VoIP App With Pjsip: Part 5