How to Make cURL works with cmake
to with How CURL CMake Make works
2023-09-27 14:25:17 时间
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.
相关文章
- Text to image论文精读 StackGAN:Text to Photo-realistic Image Synthesis with Stacked GAN具有堆叠生成对抗网络文本到图像合成
- Text to image论文精读SSA-GAN:基于语义空间感知的文本图像生成 Text to Image Generation with Semantic-Spatial Aware GAN
- NLP-信息抽取-三元组-联合抽取-结构化预测-2017:End-to-End Neural Relation Extraction with Global Optimization
- ssh连远程centos服务器时,提示报错Unable to negotiate with **** port 22: no matching host key type found,连不上。
- you are not currently on a branch.Please specify whic branch you want to merge with
- How to Build a Chat Bot Using Azure Bot Service and Train It with LUIS
- How to execute a Stored Procedure with Entity Framework Code First
- How To run OAI eNB (No S1) with USRP X310(1)
- JVM报错:Failed to write core dump. Core dumps have been disabled.
- jnhs-netbeans maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project
- 解决mysql8报错:ERROR 1410 (42000): You are not allowed to create a user with GRANT
- Debug to add expression
- How to check for null/empty/whitespace values with a single test?
- win10下 Failed to connect to github.com port 443: Timed out及OpenSSL SSL_read: Connection was reset, errno 10054
- Unable to start MySQL service. Another MySQL daemon is already running with the same UNIX socket
- Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get m
- Apache启动报错Port 80 in use by "Unable to open process" with PID 4 的解决办法.
- How to setup Eclipse with WinAVR and the Eclipse plugin AVR-eclipse
- Hex string convert to integer with stringstream
- properties starting with “$“,“_“ are not proxied in the Vue instance to prevent conflicts
- How to Export Mailboxes with Exchange Server 2010 SP1(带状态查看,清除请求,归档备份)
- How to use code to exit the application in UWP