forked from arduino-cmake/arduino-cmake
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcmake_tools.cmake
54 lines (50 loc) · 1.89 KB
/
cmake_tools.cmake
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
MACRO(Log)
MESSAGE(STATUS "Log: ${ARGN}")
ENDMACRO(Log)
#
#
#
FUNCTION(EXPORT_LIBRARY lib)
Log(${ARGN})
cmake_parse_arguments(PARSE_ARGV
1
"${lib}"
""
"NAME"
"FLAGS;INCLUDE_PATHS"
)
SET_PROPERTY(GLOBAL PROPERTY CMAKE_STM32_${lib}_FLAGS ${${lib}_FLAGS} )
SET_PROPERTY(GLOBAL PROPERTY CMAKE_STM32_${lib}_INCLUDE_PATHS ${${lib}_INCLUDE_PATHS} )
SET_PROPERTY(GLOBAL PROPERTY CMAKE_STM32_${lib}_NAME ${${lib}_NAME} )
Log("SET Include for ${lib}: <${CMAKE_STM32_${lib}_INCLUDE_PATHS}> : < ${${lib}_INCLUDE_PATHS}>")
Log("SET NAME for ${lib}: >${CMAKE_STM33_${lib}_NAME}> : <${${lib}_NAME}>")
set(unused "${${lib}_UNPARSED_ARGUMENTS}")
IF("${unused}" STREQUAL "")
ELSE("${unused}" STREQUAL "")
MESSAGE(STATUS "Unparsed Arg ${${lib}_UNPARSED_ARGUMENTS}")
ENDIF("${unused}" STREQUAL "")
ENDFUNCTION(EXPORT_LIBRARY lib)
#
#
#
MACRO(IMPORT_LIBRARY lib )
GET_PROPERTY( ${lib}_FLAGS GLOBAL PROPERTY CMAKE_STM32_${lib}_FLAGS )
GET_PROPERTY( ${lib}_INCLUDE_PATHS GLOBAL PROPERTY CMAKE_STM32_${lib}_INCLUDE_PATHS )
FOREACH(I ${${lib}_INCLUDE_PATHS} )
Log("Get Include for ${lib} : <${I}>")
include_directories( ${I} )
ENDFOREACH(I ${${lib}_INCLUDE_PATHS} )
add_definitions( ${${lib}_FLAGS} )
Log("Get FLAGS for ${lib} : <${${lib}_FLAGS}>")
ENDMACRO(IMPORT_LIBRARY lib)
#
#
#
FUNCTION(LINK_TO_LIBRARIES target )
Log("Link to lib ${ARGN}")
FOREACH(l ${ARGN})
GET_PROPERTY( ${l}_NAME GLOBAL PROPERTY CMAKE_STM32_${l}_NAME )
TARGET_LINK_LIBRARIES(${target} ${${l}_NAME})
Log("Linking to ${${l}_NAME}")
ENDFOREACH(l ${ARGN})
ENDFUNCTION(LINK_TO_LIBRARIES )