From da22c8d92221e1bc3ca0e84c59e8534fdea231fd Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Fri, 16 Sep 2022 20:29:47 +0200 Subject: Split CMakeLists.txt for src --- src/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/CMakeLists.txt (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..ba57b6f --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,47 @@ +# Avoid C11 since it is not supported by the i386-mingw32 toolchain. +set(cflags -Wall -g3 -ffunction-sections -fdata-sections -pedantic -std=c99) + +set(components + building + camera + container + font + game + gfx + gui + header + instance + keyboard + menu + mouse + pad + peripheral + player + resource + sfx + system + terrain + 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}) +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) -- cgit v1.2.3