-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathcmake.mpd
More file actions
160 lines (142 loc) · 6.88 KB
/
Copy pathcmake.mpd
File metadata and controls
160 lines (142 loc) · 6.88 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
cmake_minimum_required(VERSION <%cmake_minimum_required(3.20.0)%>)
<%marker(top)%>
project(<%project_name%> <%language%>)
option(BUILD_SHARED_LIBS "Build using shared libraries" <%if(need_staticflags)%>OFF<%else%>ON<%endif%>)
<%if(pre_find_package)%>
<%pre_find_package%>
<%endif%>
<%foreach(packages)%>
find_package(<%package%> REQUIRED)
<%endfor%>
<%if(header_files)%>
set(HEADER_FILES_<%uc(normalize(project_name))%> <%header_files%>)
<%endif%>
<%if(inline_files)%>
set(INLINE_FILES_<%uc(normalize(project_name))%> <%inline_files%>)
<%endif%>
<%if(template_files)%>
set(TEMPLATE_FILES_<%uc(normalize(project_name))%> <%template_files%>)
<%endif%>
set(SOURCE_FILES_<%uc(normalize(project_name))%> <%source_files%>)
<%if(libs || lit_libs || pure_libs)%>
<%foreach(libs)%>
<%if(cmake_macro(lib))%>
if(<%cmake_macro(lib)%>)
set(<%cmake_macro(lib)%>_DEFINED TRUE)
endif()
<%endif%>
<%endfor%>
if(CMAKE_CONFIGURATION_TYPES)
set(TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%><%if(libs)%>
<%foreach(libs)%><%fornotfirst(" ")%><%if(cmake_macro(lib))%>$<IF:$<BOOL:${<%cmake_macro(lib)%>_DEFINED}>,<%lib%>${LIBRARY_DECORATOR}<%lib_modifier%>,><%else%><%lib%>${LIBRARY_DECORATOR}<%lib_modifier%><%endif%><%endfor%><%endif%><%if(lit_libs)%>
<%lit_libs%><%endif%><%if(pure_libs)%>
<%pure_libs%><%endif%>)
else()
set(TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%><%if(libs)%><%foreach(libs)%> <%if(cmake_macro(lib))%>$<IF:$<BOOL:${<%cmake_macro(lib)%>_DEFINED}>,<%lib%>${LIBRARY_DECORATOR},><%else%><%lib%>${LIBRARY_DECORATOR}<%endif%><%endfor%><%endif%><%if(lit_libs)%> <%lit_libs%><%endif%><%if(pure_libs)%> <%pure_libs%><%endif%>)
endif()
<%endif%>
set(PROJECT_TARGET_<%uc(normalize(project_name))%> <%if(exename)%><%exename%><%else%><%if(sharedname)%><%sharedname%>${LIBRARY_DECORATOR}<%else%><%if(staticname)%><%staticname%>${LIBRARY_DECORATOR}<%else%><%project_name%>${LIBRARY_DECORATOR}<%endif%><%endif%><%endif%>)
<%marker(macros)%>
<%if(exename || sharedname || staticname)%>
<%if(compile_flags)%>
target_compile_options(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%compile_flags%>)
<%endif%>
<%if(exename)%>
add_executable(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>} ${INLINE_FILES_<%uc(normalize(project_name))%>})
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
if(CMAKE_IMPORT_LIBRARY_SUFFIX AND BUILD_SHARED_LIBS AND TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>)
add_custom_command(TARGET ${PROJECT_TARGET_<%uc(normalize(project_name))%>} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:${PROJECT_TARGET_<%uc(normalize(project_name))%>}> $<TARGET_FILE_DIR:${PROJECT_TARGET_<%uc(normalize(project_name))%>}>
COMMAND_EXPAND_LISTS
)
endif()
<%if(staticflags)%>
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
set_property(TARGET ${PROJECT_TARGET_<%uc(normalize(project_name))%>} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
<%endif%>
<%else%>
<%if(sharedname)%>
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>} ${INLINE_FILES_<%uc(normalize(project_name))%>})
<%if(dynamicflags)%>
if(BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%dynamicflags%>)
<%if(staticflags)%>
else()
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
<%endif%>
endif()
<%else%>
<%if(staticflags)%>
if(NOT BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
endif()
<%endif%>
<%endif%>
target_link_libraries(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC ${TARGET_LINK_LIBRARIES_<%uc(normalize(project_name))%>})
<%else%>
<%if(staticname)%>
add_library(${PROJECT_TARGET_<%uc(normalize(project_name))%>} ${SOURCE_FILES_<%uc(normalize(project_name))%>} ${HEADER_FILES_<%uc(normalize(project_name))%>} ${INLINE_FILES_<%uc(normalize(project_name))%>})
<%if(staticflags)%>
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%staticflags%>)
<%endif%>
<%endif%>
<%endif%>
<%if(use_lib_modifier)%>
<%foreach(configurations)%>
<%if(lib_modifier)%>
set_target_properties(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PROPERTIES <%uc(configuration)%>_POSTFIX "<%lib_modifier%>")
<%endif%>
<%endfor%>
<%endif%>
<%endif%>
if(CMAKE_CONFIGURATION_TYPES)
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC
<%foreach(configurations)%> $<$<CONFIG:<%configuration%>>:MPC_LIB_MODIFIER="${LIBRARY_DECORATOR}<%lib_modifier%>"><%fornotlast("\n")%><%endfor%>)
endif()
<%if(includes)%>
target_include_directories(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%env_includes%>)
<%endif%>
<%if(libpaths)%>
target_link_directories(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%env_libpaths%>)
<%endif%>
<%if(pch_header)%>
target_precompile_headers(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%pch_header%>)
<%endif%>
<%if(pch_source)%>
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%pch_defines%>)
<%endif%>
<%if(macros)%>
target_compile_definitions(${PROJECT_TARGET_<%uc(normalize(project_name))%>} PUBLIC <%macros%>)
<%endif%>
<%endif%>
<%if(custom_types)%>
<%foreach(custom_types)%>
<%if(custom_type->input_files)%>
<%if(custom_type->command)%>
include(<%custom_type%> OPTIONAL)
<%foreach(custom_type->input_files)%>
<%uc(custom_type)%>_TARGET_SOURCES(
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%custom_type->input_file%>
<%uc(custom_type)%>_OPTIONS <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%><%if(custom_type->output_option)%> <%custom_type->output_option%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endif%>)
<%endfor%>
<%else%>
<%foreach(custom_type->input_files)%>
<%if(custom_type->input_file->commands)%>
<%if(forfirst)%>
include(<%custom_type%> OPTIONAL)
<%endif%>
<%uc(custom_type)%>_TARGET_SOURCES(
${PROJECT_TARGET_<%uc(normalize(project_name))%>} PRIVATE <%custom_type->input_file%>
<%foreach(custom_type->input_file->commands)%>
<%uc(custom_type->input_file->command->type)%>_OPTIONS <%custom_type->input_file->command->flags%><%fornotlast("\n")%><%endfor%>)
<%endif%>
<%endfor%>
<%endif%>
<%endif%>
<%endfor%>
<%endif%>
<%marker(local)%>
<%marker(bottom)%>