-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists_static_lib.txt
54 lines (43 loc) · 1.59 KB
/
CMakeLists_static_lib.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
##########################################################
#
# Created: 25-Dec-2022
# Author: Goce Boshkovski
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License.
#
#
# Example CMakeLists.txt file for building a static library
# for AVR8 MCUs with CMake and toolchain files for both GNU avr-gcc and
# Microchip XC8 compiler.
#
##########################################################
cmake_minimum_required(VERSION 3.1)
# Define the project name
project(libDS18S20)
# Show the compiler commands during the build
set(CMAKE_VERBOSE_MAKEFILE ON)
# Define the variables/command line arguments for target MCU and MCU clock frequency
set(MCU "atmega32" CACHE STRING "Target micro-controller with default value atmega32")
set(CPU_FREQ "16000000L" CACHE STRING "MCU CPU frequency")
# Define the extra include directories here
#include_directories(/usr/local/include/avr8)
if (NOT MICROCHIP_XC8_COMPILER)
# Define linker options
add_link_options(-mmcu=${MCU} -Wl,-Map=${PROJECT_NAME}.map)
# Add mmcu as compiler option
add_compile_options(-mmcu=${MCU})
else()
# Microchip XC8 compiler
# Do not append -mmcu to linker options, aready done in toolchain file
add_link_options(-Wl,-Map=${PROJECT_NAME}.map)
endif()
# Define the F_CPU macro required for some avr-libc functions
add_definitions(-DF_CPU=${CPU_FREQ})
# Define the list of source files
set (SOURCE_LIST
ds18S20.c
)
# Build the project as a static library
add_library(DS18S20 STATIC ${SOURCE_LIST})