aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-09-16 20:29:47 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-09-16 20:29:47 +0200
commitda22c8d92221e1bc3ca0e84c59e8534fdea231fd (patch)
tree08361305c5a4c22bb8ac3659d694b0f405e399de
parent7bc21417c5f0626f6047849ae183f137ebcfd562 (diff)
Split CMakeLists.txt for src
-rw-r--r--CMakeLists.txt48
-rw-r--r--src/CMakeLists.txt47
2 files changed, 48 insertions, 47 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f46c072..13efa1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,8 +37,6 @@ endif()
set(cdroot ${CMAKE_BINARY_DIR}/cdimg)
file(MAKE_DIRECTORY ${cdroot})
-# Avoid C11 since it is not supported by the i386-mingw32 toolchain.
-set(cflags -Wall -g3 -ffunction-sections -fdata-sections -pedantic -std=c99)
if(PS1_BUILD)
include("cmake/ps1.cmake")
@@ -49,48 +47,4 @@ elseif(HOST_BUILD)
endif()
add_subdirectory("res")
-
-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("src/${c}")
- target_compile_options(${c} PUBLIC ${cflags})
-endforeach()
-
-foreach(i ${interfaces})
- add_subdirectory("src/${i}")
- target_compile_options(${i} INTERFACE ${cflags})
- target_link_libraries(${PROJECT_NAME} PRIVATE ${c})
-endforeach()
-
-target_link_options(${PROJECT_NAME} PRIVATE -Wl,--gc-sections)
+add_subdirectory("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)