jancity/src/CMakeLists.txt

55 lines
1.1 KiB
CMake

# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
set(cflags ${cflags} -Wall -g3 -ffunction-sections -fdata-sections -pedantic)
set(components
building
camera
container
font
game
gfx
gui
header
input
instance
keyboard
menu
mouse
net
packet
pad
peripheral
player
resource
settings
sfx
system
terrain
transport
unit
util
)
set(interfaces
tech
)
target_compile_options(${PROJECT_NAME} PUBLIC ${cflags})
# Dependencies for main.c
target_link_libraries(${PROJECT_NAME} PRIVATE system menu)
foreach(c ${components})
add_subdirectory("${c}")
target_compile_options(${c} PUBLIC ${cflags})
target_compile_features(${c} PUBLIC c_std_99)
set_target_properties(${c} PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)
endforeach()
foreach(i ${interfaces})
add_subdirectory("${i}")
target_compile_options(${i} INTERFACE ${cflags})
target_link_libraries(${PROJECT_NAME} PRIVATE ${c})
endforeach()
target_link_options(${PROJECT_NAME} PRIVATE -Wl,--gc-sections)