-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
39 lines (30 loc) · 1.37 KB
/
CMakeLists.txt
File metadata and controls
39 lines (30 loc) · 1.37 KB
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
## ---- CMake --------------------------------------------------------------------
project(bsp_stm32f303)
cmake_minimum_required(VERSION 2.8.8)
## ---- Build types----------------------------------------------------------------
## Check that a build type was choosen by user
if(CMAKE_BUILD_TYPE STREQUAL "")
string(ASCII 27 Esc)
set(yellow "${Esc}[33m")
set(color_reset "${Esc}[m")
set(CMAKE_BUILD_TYPE release)
message(STATUS "${yellow}Build type not set. Default is \"${CMAKE_BUILD_TYPE}\"${color_reset}")
endif(CMAKE_BUILD_TYPE STREQUAL "")
## Build type config (this is only here for being able to modify build type in cache)
set(BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Build type. May be Release|Debug|Test")
set(CMAKE_BUILD_TYPE "${BUILD_TYPE}" CACHE INTERNAL "Build type" FORCE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "System: ${CMAKE_SYSTEM_PROCESSOR}")
# Debug
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -DDEBUG_ON")
# Release
set(CMAKE_C_FLAGS_RELEASE "-Os")
## ---- Clean ---------------------------------------------------------------------
add_custom_target(Mr-Proper
COMMAND rm -r ${CMAKE_BINARY_DIR}/*
)
## ---- make package -----------------------------------------------------------
set(CPACK_GENERATOR "TBZ2")
include(CPack)
## ---- Subdirectories -----------------------------------------------------------
add_subdirectory(src)