Skip to content

Commit e04f2ab

Browse files
authored
Merge pull request #725 from FtZPetruska/cmake-find-fixes
CMake: FluidSynth and libmad find module updates
2 parents cde5f88 + fd83420 commit e04f2ab

File tree

5 files changed

+67
-163
lines changed

5 files changed

+67
-163
lines changed

prboom2/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ if(WITH_IMAGE)
5858
endif()
5959

6060
if(WITH_MAD)
61-
find_package(LibMad)
62-
if(LibMad_FOUND)
61+
find_package(mad)
62+
if(mad_FOUND)
6363
set(HAVE_LIBMAD TRUE)
6464
endif()
6565
endif()

prboom2/cmake/FindFluidSynth.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ find_file(
5656

5757
find_library(
5858
FluidSynth_LIBRARY
59-
NAMES fluidsynth libfluidsynth
59+
NAMES fluidsynth libfluidsynth fluidsynth-3 libfluidsynth-3
6060
HINTS "${PC_FLUIDSYNTH_LIBDIR}"
6161
)
6262

prboom2/cmake/FindLibMad.cmake

Lines changed: 0 additions & 159 deletions
This file was deleted.

prboom2/cmake/Findmad.cmake

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#[=======================================================================[.rst:
2+
Findmad
3+
-------
4+
5+
Finds the mad library.
6+
7+
Imported Targets
8+
^^^^^^^^^^^^^^^^
9+
10+
This module provides the following imported targets, if found:
11+
12+
``mad::mad``
13+
The mad library
14+
15+
Cache Variables
16+
^^^^^^^^^^^^^^^
17+
18+
The following cache variables may also be set:
19+
20+
``mad_INCLUDE_DIR``
21+
The directory containing ``mad.h``.
22+
``mad_LIBRARY``
23+
The path to the mad library.
24+
25+
#]=======================================================================]
26+
27+
find_package(PkgConfig QUIET)
28+
pkg_check_modules(PC_mad QUIET mad)
29+
30+
find_path(
31+
mad_INCLUDE_DIR
32+
NAMES mad.h
33+
HINTS "${PC_mad_INCLUDEDIR}"
34+
)
35+
36+
find_library(
37+
mad_LIBRARY
38+
NAMES mad mad-0
39+
HINTS "${PC_mad_LIBDIR}"
40+
)
41+
42+
include(FindPackageHandleStandardArgs)
43+
find_package_handle_standard_args(
44+
mad
45+
REQUIRED_VARS
46+
mad_LIBRARY
47+
mad_INCLUDE_DIR
48+
)
49+
50+
if(mad_FOUND AND NOT TARGET mad::mad)
51+
add_library(mad::mad UNKNOWN IMPORTED)
52+
set_target_properties(
53+
mad::mad
54+
PROPERTIES
55+
IMPORTED_LOCATION "${mad_LIBRARY}"
56+
INTERFACE_INCLUDE_DIRECTORIES "${mad_INCLUDE_DIR}"
57+
)
58+
endif()
59+
60+
mark_as_advanced(
61+
mad_INCLUDE_DIR
62+
mad_LIBRARY
63+
)

prboom2/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ function(AddGameExecutable TARGET SOURCES)
567567
endif()
568568

569569
if(HAVE_LIBMAD)
570-
target_link_libraries(${TARGET} PRIVATE LibMad::libmad)
570+
target_link_libraries(${TARGET} PRIVATE mad::mad)
571571
endif()
572572

573573
if(HAVE_LIBFLUIDSYNTH)

0 commit comments

Comments
 (0)