cmake-fetch/dependencies.cmake
2025-03-10 12:12:52 +01:00

62 lines
1.8 KiB
CMake

cmake_minimum_required(VERSION 3.11)
# Poco
set(ENABLE_MONGODB OFF)
set(ENABLE_REDIS OFF)
set(ENABLE_DATA_SQLITE OFF)
set(ENABLE_DATA_MYSQL OFF)
set(ENABLE_DATA_ODBC OFF)
set(ENABLE_ZIP OFF)
set(ENABLE_PAGECOMPILER OFF) # Disable PageCompiler (unused binary)
set(ENABLE_PAGECOMPILER_FILE2PAGE OFF) # Disable File2Page (unused binary)
# Will maybe change later, for now we want the lib to be static.
set(POCO_STATIC ON)
find_package(Poco QUIET)
if (NOT Poco_FOUND)
include(FetchContent)
FetchContent_Declare(
Poco
DOWNLOAD_EXTRACT_TIMESTAMP OFF
URL https://github.com/pocoproject/poco/archive/refs/tags/poco-1.9.4-release.tar.gz
)
FetchContent_GetProperties(Poco)
FetchContent_MakeAvailable(Poco)
set(Poco_INCLUDE_DIRS
"${poco_SOURCE_DIR}/Foundation/include"
"${poco_SOURCE_DIR}/Encodings/include"
"${poco_SOURCE_DIR}/XML/include"
"${poco_SOURCE_DIR}/JSON/include"
"${poco_SOURCE_DIR}/Util/include"
"${poco_SOURCE_DIR}/Net/include"
"${poco_SOURCE_DIR}/Data/include"
)
endif()
# LibXML2
set(LIBXML2_WITH_PROGRAMS OFF) # Disable programs
set(LIBXML2_WITH_TESTS OFF) # Disable tests
# Disabling every dependencies to build libxml2
set(LIBXML2_WITH_PYTHON OFF)
set(LIBXML2_WITH_ICONV OFF)
set(LIBXML2_WITH_LZMA OFF)
set(LIBXML2_WITH_ZLIB OFF)
# Will maybe change later, for now we want the lib to be static.
set(BUILD_SHARED_LIBS OFF)
find_package(libxml2 QUIET)
if (NOT (libxml2_FOUND OR LIBXML2_FOUND))
include(FetchContent)
FetchContent_Declare(
libxml2
GIT_REPOSITORY https://gitlab.gnome.org/GNOME/libxml2.git
GIT_TAG v2.12.6
)
FetchContent_GetProperties(libxml2)
FetchContent_MakeAvailable(libxml2)
set(LIBXML2_INCLUDE_DIR
"${libxml2_SOURCE_DIR}/include"
"${libxml2_BINARY_DIR}"
)
set(LIBXML2_LIBRARY "${libxml2_BINARY_DIR}/libxml2.a")
endif()