Skip to content

Commit 9ade8a9

Browse files
committed
fix: make USE_OPENGL compile definitions conditional
The USE_OPENGL compile definition was being added unconditionally to the client and main executable targets, even when USE_OPENGL option was set to OFF. This could cause incorrect code paths to be enabled at compile time. Changes: - Make client target USE_OPENGL definition conditional: $<$<BOOL:>:USE_OPENGL> - Make main executable USE_OPENGL definition conditional: $<$<BOOL:>:USE_OPENGL> This ensures that when USE_OPENGL=OFF, the USE_OPENGL preprocessor definition is not set, preventing compilation of OpenGL-specific code paths.
1 parent d9761cd commit 9ade8a9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ TARGET_INCLUDE_DIRECTORIES(client PRIVATE src/client/mp3)
18531853
message(STATUS "MP3 support enabled with custom mp3")
18541854

18551855
# Define renderer flags for client
1856-
TARGET_COMPILE_DEFINITIONS(client PRIVATE USE_OPENGL USE_VULKAN USE_SDL)
1856+
TARGET_COMPILE_DEFINITIONS(client PRIVATE $<$<BOOL:${USE_OPENGL}>:USE_OPENGL> USE_VULKAN USE_SDL)
18571857

18581858
IF(USE_CIMGUI AND DEFINED CIMGUI_DIR)
18591859
set(CIMGUI_USER_CONFIG "\"cimconfig.h\"")
@@ -3276,7 +3276,7 @@ ENDIF()
32763276
TARGET_LINK_LIBRARIES(${CNAME}${BINEXT} PRIVATE botlib client common q3ui GL)
32773277
TARGET_LINK_OPTIONS(${CNAME}${BINEXT} PRIVATE -Wl,--export-dynamic)
32783278
TARGET_INCLUDE_DIRECTORIES(${CNAME}${BINEXT} PRIVATE src/common src)
3279-
TARGET_COMPILE_DEFINITIONS(${CNAME}${BINEXT} PRIVATE USE_OPENGL)
3279+
TARGET_COMPILE_DEFINITIONS(${CNAME}${BINEXT} PRIVATE $<$<BOOL:${USE_OPENGL}>:USE_OPENGL>)
32803280
IF(USE_UI2)
32813281
TARGET_LINK_LIBRARIES(${CNAME}${BINEXT} PRIVATE ui2)
32823282
ENDIF()

0 commit comments

Comments
 (0)