don't need to check the same thing 5 times.

This commit is contained in:
pentarctagon 2024-05-12 23:12:10 -05:00
parent fa2770603b
commit c3ddf890ed

View file

@ -74,32 +74,21 @@ if(HISTORY_FOUND)
endif()
# get source lists
if(NOT ENABLE_SYSTEM_LUA)
GetSources("lua" lua_sources)
endif()
GetSources("libwesnoth_sdl" wesnoth_sdl_sources)
GetSources("libwesnoth_widgets" wesnoth_widget-sources)
GetSources("libwesnoth" wesnoth_game_sources)
GetSources("libwesnoth_core" wesnoth_core_sources)
GetSources("wesnoth" wesnoth_sources)
if(NOT ENABLE_SYSTEM_LUA)
GetSources("lua" lua_sources)
# Inject a header into the Lua sources for Wesnoth-specific changes
# makedepend won't see it so we have to specifically add it as a dependency.
file(GLOB wesnoth_lua_config wesnoth_lua_config.h)
set_source_files_properties(${lua_sources} PROPERTIES OBJECT_DEPENDS ${wesnoth_lua_config})
endif()
if(WIN32)
set(wesnoth_core_sources ${wesnoth_core_sources} log_windows.cpp)
set(wesnoth_game_sources ${wesnoth_game_sources} desktop/windows_tray_notification.cpp desktop/windows_battery_info.cpp)
endif()
if(NOT ENABLE_SYSTEM_LUA)
set_source_files_properties(${lua_sources} PROPERTIES LANGUAGE CXX)
endif()
if(NOT ENABLE_SYSTEM_LUA)
# We explicitly want lua compiled as C++ version
if(MSVC)
set_source_files_properties(${lua_sources} PROPERTIES COMPILE_FLAGS "/FI\"${wesnoth_lua_config}\"")
@ -108,9 +97,7 @@ if(NOT ENABLE_SYSTEM_LUA)
else()
set_source_files_properties(${lua_sources} PROPERTIES COMPILE_FLAGS "-include \"${wesnoth_lua_config}\" -x c++ -Wno-old-style-cast -Wno-useless-cast -Wno-stringop-overflow")
endif()
endif()
if(NOT ENABLE_SYSTEM_LUA)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# silence a Clang specific warning due to extra parenthesis in if statements
set_property(SOURCE SOURCE ${lua_sources} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-parentheses-equality")
@ -119,6 +106,11 @@ if(NOT ENABLE_SYSTEM_LUA)
endif()
endif()
if(WIN32)
set(wesnoth_core_sources ${wesnoth_core_sources} log_windows.cpp)
set(wesnoth_game_sources ${wesnoth_game_sources} desktop/windows_tray_notification.cpp desktop/windows_battery_info.cpp)
endif()
# On apple only
if(APPLE)
set(wesnoth_game_sources