-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
65 lines (52 loc) · 1.51 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
project("stm32_project")
cmake_minimum_required(VERSION 3.20)
SET(CMAKE_PROJECT_VERSION 1.0)
SET(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
# Enable some policies
if(POLICY CMP0007)
cmake_policy(SET CMP0007 NEW)
endif()
if(POLICY CMP0012)
cmake_policy(SET CMP0012 NEW)
endif()
cmake_policy(SET CMP0057 NEW)
cmake_policy(SET CMP0076 NEW)
#SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
SET(TARGET_GROUP test CACHE STRING "What Should I Build?")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type. Debug or Release" FORCE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
endif()
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(VVERSION DEBUG CACHE STRING "Is debug mode")
set(IVERSION 666 CACHE STRING "Integer version")
set(CMAKE_C_COMPILER_ID "Clang")
include("cmake/CMakeSetCompiler.cmake")
include("cmake/GlobSrcAndHeaders.cmake")
include("cmake/STM32CommonTarget.cmake")
include("cmake/ExecutableFromMakefile.cmake")
include("cmake/STM32_flash.cmake")
SET(STM32_C_COMMON_FLAGS
-std=gnu17
-dM
-Wall
-mthumb
-fno-common
-fomit-frame-pointer
-ffunction-sections -fdata-sections
-Wenum-conversion
-fshort-enums
)
SET(STM32_LINK_COMMON_FLAGS
-specs=nosys.specs
-Wl,--gc-sections
-u _printf_float
-Wl,--print-memory-usage
${STM32_C_COMMON_FLAGS}
)
set(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g -gdwarf-2 -Og")
set(CMAKE_C_FLAGS_RELEASE "-Ofast")
ADD_STM32_COMMON_TARGET()
#ADD_FLASH("name_of_project.hex" "name")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
endif()