1<<$srcs := getSources .M>>
2<<$includeDirs := getIncludeDirs .Ctx .M>>
3<<$cflags := getCflagsProperty .Ctx .M>>
4<<$deps := mapLibraries .Ctx .M (concat5
5(getLinkerProperties .M).Whole_static_libs
6(getLinkerProperties .M).Static_libs
7(getLinkerProperties .M).Shared_libs
8(getLinkerProperties .M).Header_libs
9(getExtraLibs .M)
10) .Pprop.LibraryMapping>>
11<<$moduleType := getModuleType .M>>
12<<$moduleTypeCmake := "executable">>
13<<if eq $moduleType "library">>
14<<$moduleTypeCmake = "library">>
15<<end>>
16
17# <<.M.Name>>
18<<if $srcs>>
19<<setList .M.Name "_SRCS" "${ANDROID_BUILD_TOP}/" (toStrings $srcs)>>
20add_<<$moduleTypeCmake>>(<<.M.Name>> ${<<.M.Name>>_SRCS})
21<<- else>>
22add_<<$moduleTypeCmake>>(<<.M.Name>> INTERFACE)
23<<- end>>
24<<- if eq $moduleType "library">>
25add_library(android::<<.M.Name>> ALIAS <<.M.Name>>)
26<<- else if eq $moduleType "test">>
27add_test(NAME <<.M.Name>> COMMAND <<.M.Name>>)
28<<- end>>
29<<print "">>
30
31<<- if $includeDirs>>
32<<setList .M.Name "_INCLUDES" "${ANDROID_BUILD_TOP}/" $includeDirs>>
33target_include_directories(<<.M.Name>> <<if $srcs>>PUBLIC<<else>>INTERFACE<<end>> ${<<.M.Name>>_INCLUDES})
34<<end>>
35
36<<- if and $srcs $cflags>>
37<<cflagsList .M.Name "_CFLAGS" $cflags .Snapshot.Properties.Unportable_flags .Snapshot.Properties.Cflags_ignored>>
38target_compile_options(<<.M.Name>> PRIVATE ${<<.M.Name>>_CFLAGS})
39<<end>>
40
41<<- if $deps>>
42<<setList .M.Name "_DEPENDENCIES" "" $deps>>
43target_link_libraries(<<.M.Name>> <<if not $srcs>>INTERFACE <<end ->> ${<<.M.Name>>_DEPENDENCIES})
44<<end>>
45