Search code examples
c++cmakegame-engine

cmake error libcurl not found, but libcurl4 is installed


I am trying to compile the Springlobby version 268 client from the open source game TA-Spring. However the newest version (271) compiles just fine. But when I try to compile version 268 I get the CMake-error:

CMake Error at /usr/share/cmake-3.18/Modules/FindCURL.cmake:163 (message):
  CURL: Required feature libcurl is not found
Call Stack (most recent call first):
  src/CMakeLists.txt:127 (FIND_PACKAGE)

I am compiling on Debian testing and tried the libraries libcurl4-openssl-dev, libcurl-gnutls-dev and libcurl4-nss-dev all without success.

game: https://springrts.com
lobby 0.271: https://github.com/springlobby/springlobby
lobby 0.268: https://github.com/springlobby/springlobby/tree/0.268
install from source: https://github.com/springlobby/springlobby/wiki/Installfromsource

Building the lobby from git repo:

git clone --recursive https://github.com/springlobby/springlobby.git
cd springlobby
cmake .
make
make install

The Springlobby version 271 uses libcurl4-openssl-dev but version 268 seemingly links to an older libcurl.


Solution

  • Version 268 incorrectly calls find_package (src/CMakeLists.txt:127):

    FIND_PACKAGE( CURL REQUIRED libcurl )
    

    The last parameter libcurl is interpreted (according to find_package documentation) as the element of COMPONENTS list, and in case of FindCURL.cmake it is treated as PROTOCOL/FEATURE specification. Obviously, libcurl means neither protocol nor feature.

    Commit https://github.com/springlobby/springlobby/commit/252c4cb156c1442ed9b4faec3f26265bc7c295ff fixes this call to

    FIND_PACKAGE(CURL REQUIRED)