generated from ThundeRatz/STM32ProjectTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
40 lines (31 loc) · 1.03 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
project(micras_hal)
get_target_property(CUBE_INCLUDE_DIRECTORIES stm32cubemx INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(CUBE_SOURCES stm32cubemx INTERFACE_SOURCES)
get_target_property(CUBE_COMPILE_DEFINITIONS stm32cubemx INTERFACE_COMPILE_DEFINITIONS)
# Remove warnings from Cube sources
set_source_files_properties(
${CUBE_SOURCES}
PROPERTIES
COMPILE_FLAGS "-w"
)
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "src/*.c*")
add_library(${PROJECT_NAME} STATIC
${PROJECT_SOURCES}
)
target_include_directories(${PROJECT_NAME} PUBLIC
include
)
target_link_libraries(${PROJECT_NAME} PRIVATE
stm32cubemx
)
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
${CUBE_INCLUDE_DIRECTORIES}
)
target_compile_definitions(${PROJECT_NAME} PUBLIC
${CUBE_COMPILE_DEFINITIONS}
)
add_library(micras_hal_whole_archive INTERFACE)
add_library(micras::hal ALIAS micras_hal_whole_archive)
target_link_libraries(micras_hal_whole_archive INTERFACE
"-Wl,--whole-archive" ${PROJECT_NAME} "-Wl,--no-whole-archive"
)