blockattack / blockattack-game

Block Attack - Rise of the Blocks - the game
https://blockattack.net
GNU General Public License v2.0
34 stars 8 forks source link

FindSDL2.cmake is obsolete, please rely on the CMake config-file package #23

Closed apoleon closed 2 years ago

apoleon commented 4 years ago

blockattack has a FindSDL2.cmake "find-module". Blockattack assumes that the CFLAGS necessary to find SDL.h are also sufficient to find SDL_mixer.h. This will cause a build failure when this assumption is not true. I am attaching a patch by Simon McVittie that solves the problem.

Blockattack should ideally also drop FindSDL2.cmake and rely on the CMake support in SDL2 >= 2.0.4 (it is now a "config-file package" in CMake terminology), similar to https://github.com/JACoders/OpenJK/pull/1033.

This is Debian bug https://bugs.debian.org/951943

Patch:

From: Simon McVittie smcv@debian.org Date: Sun, 23 Feb 2020 14:28:29 +0000 Subject: build: Add include directories for all SDL2_foo modules

The build system assumed that SDL2 and all the SDL2_foo libraries were installed with the same ${includedir}, but this is not guaranteed: we could be using a system copy of SDL2 in conjunction with SDL2_foo libraries in a non-standard prefix.

This also fixes a build regression with recent Debian SDL2 packages, in which the SDL2 headers are installed in an architecture-dependent directory but the SDL2_foo headers are not.

Signed-off-by: Simon McVittie smcv@debian.org Bug-Debian: https://bugs.debian.org/951943

CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt index d4d7644..91bdcbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,8 +60,11 @@ include_directories(${SDL2_INCLUDE_DIR})

Setup things that use pkg-config

find_package(PkgConfig REQUIRED) pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer) +include_directories(${SDL2MIXER_INCLUDE_DIRS}) pkg_search_module(SDL2IMAGE REQUIRED SDL2_image) +include_directories(${SDL2IMAGE_INCLUDE_DIRS}) pkg_search_module(SDL2TTF REQUIRED SDL2_ttf) +include_directories(${SDL2TTF_INCLUDE_DIRS})

find_package(Boost COMPONENTS program_options REQUIRED)

sago007 commented 2 years ago

Ubuntu 16.04 is no longer supported, so FindSDL2.cmake is no longer needed.

This was done in commit: 00a2e90a4e551248631b55108701b2006ede9cf4

I am closing this issue.