Skip to content

Commit 186d3ce

Browse files
[CMake] Properly remove raudio.c and rmodels.c if they're disabled modules (#5878)
* only build raudio.c in cmake if it's still enabled * only compile rmodels if it's supported
1 parent e7edb18 commit 186d3ce

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,22 @@ set(raylib_public_headers
3030

3131
# Sources to be compiled
3232
set(raylib_sources
33-
raudio.c
3433
rcore.c
35-
rmodels.c
3634
rshapes.c
3735
rtext.c
3836
rtextures.c
3937
)
4038

39+
# Only build raudio if it's enabled
40+
if (NOT DEFINED SUPPORT_MODULE_RAUDIO OR SUPPORT_MODULE_RAUDIO)
41+
list(APPEND raylib_sources raudio.c)
42+
endif()
43+
44+
# Only build rmodels if it's enabled
45+
if (NOT DEFINED SUPPORT_MODULE_RMODELS OR SUPPORT_MODULE_RMODELS)
46+
list(APPEND raylib_sources rmodels.c)
47+
endif()
48+
4149
# <root>/cmake/GlfwImport.cmake handles the details around the inclusion of glfw
4250
if (NOT ${PLATFORM} MATCHES "Web")
4351
include(GlfwImport)
@@ -48,10 +56,10 @@ endif ()
4856
# Produces a variable LIBS_PRIVATE that will be used later
4957
include(LibraryConfigurations)
5058

51-
if (SUPPORT_MODULE_RAUDIO)
52-
MESSAGE(STATUS "Audio Backend: miniaudio")
53-
else ()
59+
if (DEFINED SUPPORT_MODULE_RAUDIO AND NOT SUPPORT_MODULE_RAUDIO)
5460
MESSAGE(STATUS "Audio Backend: None (-DCUSTOMIZE_BUILD=ON -DSUPPORT_MODULE_RAUDIO=OFF)")
61+
else ()
62+
MESSAGE(STATUS "Audio Backend: miniaudio")
5563
endif ()
5664

5765
add_library(raylib ${raylib_sources} ${raylib_public_headers})

0 commit comments

Comments
 (0)