CMake: Detect libcurl and use it when found

Move ID_ENABLE_CURL to config.h
This commit is contained in:
dhewg 2012-01-14 14:24:28 +01:00 committed by Daniel Gibson
parent 6dfe95e732
commit a6796cb444
3 changed files with 7 additions and 9 deletions

View file

@ -31,7 +31,6 @@ option(GAME "Build the base game code" ON)
option(D3XP "Build the d3xp game code" OFF) option(D3XP "Build the d3xp game code" OFF)
option(DEDICATED "Build the dedicated server" OFF) option(DEDICATED "Build the dedicated server" OFF)
option(X86 "Cross compile for x86 (only applicable on x86_64)" OFF) option(X86 "Cross compile for x86 (only applicable on x86_64)" OFF)
option(CURL "Enable usage of libcurl for http/ftp downloads" OFF)
option(ONATIVE "Optimize for the host CPU" OFF) option(ONATIVE "Optimize for the host CPU" OFF)
if (NOT CMAKE_SYSTEM_PROCESSOR) if (NOT CMAKE_SYSTEM_PROCESSOR)
@ -108,12 +107,13 @@ include_directories(${OPENGL_INCLUDE_DIR})
find_package(SDL REQUIRED) find_package(SDL REQUIRED)
include_directories(${SDL_INCLUDE_DIR}) include_directories(${SDL_INCLUDE_DIR})
if (CURL) find_package(CURL QUIET)
find_package(CURL REQUIRED) if (CURL_FOUND)
add_definitions(-DID_ENABLE_CURL=1) set(ID_ENABLE_CURL ON)
include_directories(${CURL_INCLUDE_DIR}) include_directories(${CURL_INCLUDE_DIR})
else() else()
add_definitions(-DID_ENABLE_CURL=0) message(STATUS "libcurl not found, server downloads won't be available")
set(ID_ENABLE_CURL OFF)
endif() endif()
# compiler specific flags # compiler specific flags

View file

@ -3,4 +3,6 @@
#cmakedefine HAVE_JPEG_MEM_SRC #cmakedefine HAVE_JPEG_MEM_SRC
#cmakedefine ID_ENABLE_CURL
#endif #endif

View file

@ -60,10 +60,6 @@ If you have questions concerning this license or the applicable additional terms
#define ID_ALLOW_CHEATS 0 #define ID_ALLOW_CHEATS 0
#endif #endif
#ifndef ID_ENABLE_CURL
#define ID_ENABLE_CURL 1
#endif
// fake a pure client. useful to connect an all-debug client to a server // fake a pure client. useful to connect an all-debug client to a server
#ifndef ID_FAKE_PURE #ifndef ID_FAKE_PURE
#define ID_FAKE_PURE 0 #define ID_FAKE_PURE 0