@@ -11,23 +11,52 @@ if (NOT TARGET _family_support_marker)
11
11
12
12
function (family_filter RESULT DIR )
13
13
get_filename_component (DIR ${DIR} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
14
- file (GLOB ONLYS "${DIR} /.only.MCU_*" )
15
- if (ONLYS )
14
+
15
+ if (EXISTS "${DIR} /only.txt" )
16
+ file (READ "${DIR} /only.txt" ONLYS )
17
+ # Replace newlines with semicolon so that it is treated as a list by CMake
18
+ string (REPLACE "\n " ";" ONLYS_LINES ${ONLYS} )
19
+ # For each mcu
16
20
foreach (MCU IN LISTS FAMILY_MCUS )
17
- if (EXISTS ${DIR} /.only.MCU_${MCU} )
18
- set (${RESULT} 1 PARENT_SCOPE )
19
- return ()
20
- endif ()
21
+ # For each line in only.txt
22
+ foreach (_line ${ONLYS_LINES} )
23
+ # If mcu:xxx exists for this mcu then include
24
+ if (${_line} STREQUAL "mcu:${MCU} " )
25
+ set (${RESULT} 1 PARENT_SCOPE )
26
+ return ()
27
+ endif ()
28
+ endforeach ()
21
29
endforeach ()
22
- else ()
30
+
31
+ # Didn't find it in only file so don't build
32
+ set (${RESULT} 0 PARENT_SCOPE )
33
+
34
+ elseif (EXISTS "${DIR} /skip.txt" )
35
+ file (READ "${DIR} /skip.txt" SKIPS )
36
+ # Replace newlines with semicolon so that it is treated as a list by CMake
37
+ string (REPLACE "\n " ";" SKIPS_LINES ${SKIPS} )
38
+ # For each mcu
23
39
foreach (MCU IN LISTS FAMILY_MCUS )
24
- if (EXISTS ${DIR} /.skip.MCU_${MCU} )
25
- set (${RESULT} 0 PARENT_SCOPE )
26
- return ()
27
- endif ()
40
+ # For each line in only.txt
41
+ foreach (_line ${SKIPS_LINES} )
42
+ # If mcu:xxx exists for this mcu then skip
43
+ if (${_line} STREQUAL "mcu:${MCU} " )
44
+ set (${RESULT} 0 PARENT_SCOPE )
45
+ return ()
46
+ endif ()
47
+ endforeach ()
28
48
endforeach ()
49
+
50
+ # Didn't find in skip file so build
51
+ set (${RESULT} 1 PARENT_SCOPE )
52
+
53
+ else ()
54
+
55
+ # Didn't find skip or only file so build
56
+ set (${RESULT} 1 PARENT_SCOPE )
57
+
29
58
endif ()
30
- set ( ${RESULT} 1 PARENT_SCOPE )
59
+
31
60
endfunction ()
32
61
33
62
function (family_add_subdirectory DIR )
0 commit comments