Skip to content

Commit

Permalink
CMake: Moved the option flags to the targets
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatyas committed Aug 3, 2023
1 parent c4c943b commit 385487d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,6 @@ if(WIN32)
endif()
option(SMW_INSTALL_PORTABLE "Install to a single directory" ${SMW_INSTALL_PORTABLE_DEFAULT})

if (USE_SDL2_LIBS)
add_definitions(-DUSE_SDL2)

if (SDL2_USE_MIXERX)
add_definitions(-DSDL2_USE_MIXERX)
endif()

if (SDL2_FORCE_GLES)
add_definitions(-DSDL2_FORCE_GLES)
endif()
endif()

if (NO_NETWORK)
add_definitions(-DNETWORK_DISABLED)
endif()

if (USE_PNG_SAVE)
add_definitions(-DPNG_SAVE_FORMAT)
endif()

# Additional CMake search path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

Expand Down
15 changes: 15 additions & 0 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ if (USE_PNG_SAVE AND NOT USE_SDL2_LIBS)
endif()


if (USE_SDL2_LIBS)
target_compile_definitions(CommonFiles PUBLIC USE_SDL2)

if (SDL2_FORCE_GLES)
target_compile_definitions(CommonFiles PUBLIC SDL2_FORCE_GLES)
endif()
if (SDL2_USE_MIXERX)
target_compile_definitions(CommonFiles PUBLIC SDL2_USE_MIXERX)
endif()
endif()
if (USE_PNG_SAVE)
target_compile_definitions(CommonFiles PUBLIC PNG_SAVE_FORMAT)
endif()


if(NOT EMSCRIPTEN)
if (USE_SDL2_LIBS)
target_link_libraries(CommonFiles
Expand Down
4 changes: 3 additions & 1 deletion src/smw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ target_sources(smw PRIVATE
ui/MI_NetRoomTeamSelect.cpp
)

if(NOT NO_NETWORK)
if(NO_NETWORK)
target_compile_definitions(smw PRIVATE NETWORK_DISABLED)
else()
target_sources(smw PRIVATE platform/network/enet/NetworkLayerENet.cpp)
endif()

Expand Down

0 comments on commit 385487d

Please sign in to comment.