From a24899bf2dcd58916922d671ee8761448b6876e5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 20 Apr 2021 19:50:34 +0200 Subject: Look for PostgreSQL library properly and fix CI --- README.md | 2 +- src/CMakeLists.txt | 11 ++++++++++- util/ci/common.sh | 3 +-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 662b5c4ca..0b9907992 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ Compiling | Dependency | Version | Commentary | |------------|---------|------------| | GCC | 4.9+ | Can be replaced with Clang 3.4+ | -| CMake | 2.6+ | | +| CMake | 3.5+ | | | Irrlicht | - | Custom version required, see https://github.com/minetest/irrlicht | | SQLite3 | 3.0+ | | | LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 16b5bf991..f70e77dcc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -146,7 +146,16 @@ option(ENABLE_POSTGRESQL "Enable PostgreSQL backend" TRUE) set(USE_POSTGRESQL FALSE) if(ENABLE_POSTGRESQL) - find_package("PostgreSQL") + if(CMAKE_VERSION VERSION_LESS "3.20") + find_package(PostgreSQL QUIET) + # Before CMake 3.20 FindPostgreSQL.cmake always looked for server includes + # but we don't need them, so continue anyway if only those are missing. + if(PostgreSQL_INCLUDE_DIR AND PostgreSQL_LIBRARY) + set(PostgreSQL_FOUND TRUE) + endif() + else() + find_package(PostgreSQL) + endif() if(PostgreSQL_FOUND) set(USE_POSTGRESQL TRUE) diff --git a/util/ci/common.sh b/util/ci/common.sh index ca2ecbc29..1083581b5 100644 --- a/util/ci/common.sh +++ b/util/ci/common.sh @@ -5,8 +5,7 @@ install_linux_deps() { local pkgs=(cmake libpng-dev \ libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev \ - gettext libpq-dev postgresql-server-dev-all libleveldb-dev \ - libcurl4-openssl-dev) + gettext libpq-dev libleveldb-dev libcurl4-openssl-dev) if [[ "$1" == "--old-irr" ]]; then shift -- cgit v1.2.3