我下载了"curl library"以用于第三方应用程序.当我运行包含的cmake文件时,我收到以下错误.请帮我.我很感激:
> The C compiler identification is MSVC 18.0.30501.0 > The CXX compiler identification is MSVC 18.0.30501.0 > Check for working C compiler using: Visual Studio 12 2013 > Check for working C compiler using: Visual Studio 12 2013 -- works > Detecting C compiler ABI info > Detecting C compiler ABI info - done > Check for working CXX compiler using: Visual Studio 12 2013 > Check for working CXX compiler using: Visual Studio 12 2013 -- works > Detecting CXX compiler ABI info > Detecting CXX compiler ABI info - done > Could NOT find CURL (missing: CURL_LIBRARY) (found version "7.38.0") > CMake Error at CMakeLists.txt:49 (MESSAGE): > Could not find the CURL library and development files. > > Configuring incomplete, errors occurred! > See also "C:/BUILD/CMakeFiles/CMakeOutput.log".
我在Windows中为"CURL_LIBRARY"设置环境变量以指向curl的库文件安装位置,但是即使cxke指示在我的系统上检测到版本7.38.0,它仍然无法找到它.
谢谢您的帮助..
编辑:cMakeLists.txt文件
... # Look for required libraries SET(requiredlibs) FIND_PACKAGE(CURL) IF(CURL_FOUND) INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR}) SET(requiredlibs ${requiredlibs} ${CURL_LIBRARIES} ) ELSE(CURL_FOUND) MESSAGE(FATAL_ERROR "Could not find the CURL library and development files.") ENDIF(CURL_FOUND) ...
我在Windows环境变量中设置了include和lib目录,但没有变化.
编辑:这是完整的项目文件:cmake项目.
我遇到了同样的问题,这个问题在我的搜索过程中是最重要的问题之一.所以我给出了我找到的解决方案.以下cmake让我在我的代码中使用libcurl include.希望它对某人有用.
set(CURL_LIBRARY "-lcurl") find_package(CURL REQUIRED) add_executable (curl-demo convert.cpp) include_directories(${CURL_INCLUDE_DIR}) target_link_libraries(curl-demo ${CURL_LIBRARIES})