File wesnoth-cmake-fix-find-readline.patch of Package wesnoth-1.16
diff -Nur wesnoth-1.16.2.orig/cmake/FindReadline.cmake wesnoth-1.16.2/cmake/FindReadline.cmake
--- wesnoth-1.16.2.orig/cmake/FindReadline.cmake 1970-01-01 01:00:00.000000000 +0100
+++ wesnoth-1.16.2/cmake/FindReadline.cmake 2022-02-26 17:25:21.206738255 +0100
@@ -0,0 +1,47 @@
+# - Try to find readline include dirs and libraries
+#
+# Usage of this module as follows:
+#
+# find_package(Readline)
+#
+# Variables used by this module, they can change the default behaviour and need
+# to be set before calling find_package:
+#
+# Readline_ROOT_DIR Set this variable to the root installation of
+# readline if the module has problems finding the
+# proper installation path.
+#
+# Variables defined by this module:
+#
+# READLINE_FOUND System has readline, include and lib dirs found
+# Readline_INCLUDE_DIR The readline include directories.
+# Readline_LIBRARY The readline library.
+
+find_path(Readline_ROOT_DIR
+ NAMES include/readline/readline.h
+ )
+
+find_path(Readline_INCLUDE_DIR
+ NAMES readline/readline.h
+ HINTS ${Readline_ROOT_DIR}/include
+ )
+
+find_library(Readline_LIBRARY
+ NAMES readline
+ HINTS ${Readline_ROOT_DIR}/lib
+ )
+
+if (Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
+ set(READLINE_FOUND TRUE)
+else (Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
+ FIND_LIBRARY(Readline_LIBRARY NAMES readline)
+ include(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY)
+ MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
+endif (Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
+
+mark_as_advanced(
+ Readline_ROOT_DIR
+ Readline_INCLUDE_DIR
+ Readline_LIBRARY
+)
diff -Nur wesnoth-1.16.2.orig/CMakeLists.txt wesnoth-1.16.2/CMakeLists.txt
--- wesnoth-1.16.2.orig/CMakeLists.txt 2022-01-16 19:10:36.000000000 +0100
+++ wesnoth-1.16.2/CMakeLists.txt 2022-02-26 17:33:50.183109995 +0100
@@ -479,6 +479,7 @@
find_package(VorbisFile REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(Fontconfig REQUIRED)
+ find_package(Readline REQUIRED)
if(NOT MSVC)
# for everything else, use pkgconfig
# find_package can't be used for SDL2 since at least as of Ubuntu 20.04 they forgot to include the sdl2-config-version.cmake, so cmake can't tell if it's >= 2.0.8 and thus rejects using it
@@ -500,7 +501,6 @@
# TODO: can use find_package and Fontconfig::Fontconfig with cmake 3.14+
pkg_check_modules(FONTCONFIG REQUIRED fontconfig>=2.4.1)
pkg_check_modules(PANGO REQUIRED pango>=1.22.0)
- pkg_check_modules(LIBREADLINE REQUIRED readline)
endif()
if(ENABLE_TESTS)