Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)

When I built a project with CMake, I got this error:

 Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)
Call Stack (most recent call first):
C:/CMake/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
C:/CMake/share/cmake-3.25/Modules/FindCURL.cmake:182 (find_package_handle_standard_args)
cmake/libcurl.cmake:5 (find_package)
CMakeLists.txt:254 (include)

Apparently, CMake says it cannot find curl on Windows. But open a cmd window, I can run the curl command without problem, which means curl is actually shipped with Windows. But the curl.exe is not the file CMake needs. CMake is actually looking for the curl libs and curl include files which are required to build the project. The curl libraries and header files are provided in the curl development package. You can download the curl dev-pacakge for Windows,  extract it to a directory such as c:\curl, then use the following command to build the project with CMake specifying the curl lib path and curl include path:

cmake -G Ninja -DCURL_LIBRARY=C:\curl\lib\libcurl.dll.a -DCURL_INCLUDE_DIR=C:\curl\include -DCMAKE_INSTALL_PREFIX=C:\projectinstalldir -S C:\projectsourcedir -B C:\projectbuilddir

If you encounter the error “Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR)” in Linux, you should install the curl-dev package. On Ubuntu, run the following command:

sudo apt-get install libcurl4-openssl-dev

On Centos, run the following command:

yum install libcurl-devel

 

Did you like this?
Tip admin with Cryptocurrency

Donate Bitcoin to admin

Scan to Donate Bitcoin to admin
Scan the QR code or copy the address below into your wallet to send some bitcoin:

Donate Bitcoin Cash to admin

Scan to Donate Bitcoin Cash to admin
Scan the QR code or copy the address below into your wallet to send bitcoin:

Donate Ethereum to admin

Scan to Donate Ethereum to admin
Scan the QR code or copy the address below into your wallet to send some Ether:

Donate Litecoin to admin

Scan to Donate Litecoin to admin
Scan the QR code or copy the address below into your wallet to send some Litecoin:

Donate Monero to admin

Scan to Donate Monero to admin
Scan the QR code or copy the address below into your wallet to send some Monero:

Donate ZCash to admin

Scan to Donate ZCash to admin
Scan the QR code or copy the address below into your wallet to send some ZCash:

Leave a Reply