summaryrefslogtreecommitdiff
path: root/templates/cmake.mpd
blob: 8a7269d8ffca9065d1390960f54681171ff9d0f7 (plain)
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
cmake_minimum_required(VERSION <%cmake_minimum_required(3.12.0)%>)

<%marker(top)%>
project(<%project_name%> <%language%>)

<%if(contains(includes, DDS_ROOT))%>
find_package(OpenDDS REQUIRED)

<%else%>
<%if(contains(includes, TAO_ROOT))%>
find_package(TAO REQUIRED)

<%else%>
<%if(contains(includes, ACE_ROOT))%>
find_package(ACE REQUIRED)

<%else%>
<%endif%>
<%endif%>
<%endif%>
set(SOURCE_FILES <%source_files%>)
<%if(libs || lit_libs || pure_libs)%>
set(TARGET_LINK_LIBRARIES<%if(libs)%> <%foreach(configurations)%><%fornotfirst("                          ")%>$<$<CONFIG:<%configuration%>>:<%foreach(libs)%><%fornotfirst(" ")%><%lib%><%lib_modifier%><%endfor%>><%fornotlast("
")%><%endfor%><%endif%><%if(lit_libs)%> <%lit_libs%><%endif%><%if(pure_libs)%> <%pure_libs%><%endif%>)
<%endif%>
set(PROJECT_TARGET <%if(exename)%><%exename%><%else%><%if(sharedname)%><%sharedname%><%else%><%if(staticname)%><%staticname%><%else%><%project_name%><%endif%><%endif%><%endif%>)
<%marker(macros)%>

<%if(libout)%>
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY <%env_libout%>)
<%endif%>
<%if(dllout || libout)%>
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY <%if(dllout)%><%env_dllout%><%else%><%env_libout%><%endif%>)
<%endif%>
<%if(exeout)%>
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY <%env_exeout%>)
<%endif%>

<%if(exename)%>
add_executable(${PROJECT_TARGET} ${SOURCE_FILES})
target_link_libraries(${PROJECT_TARGET} ${TARGET_LINK_LIBRARIES})
<%else%>
<%if(sharedname)%>
add_library(${PROJECT_TARGET} SHARED ${SOURCE_FILES})
add_compile_definitions(<%dynamicflags%>)
target_link_libraries(${PROJECT_TARGET} ${TARGET_LINK_LIBRARIES})
<%else%>
<%if(staticname)%>
add_library(${PROJECT_TARGET} ${SOURCE_FILES})
add_compile_definitions(<%staticflags%>)
<%endif%>
<%endif%>
<%endif%>

<%if(includes)%>
target_include_directories(${PROJECT_TARGET} PUBLIC <%env_includes%>)

<%endif%>
<%if(libpaths)%>
target_link_directories(${PROJECT_TARGET} PUBLIC <%env_libpaths%>)

<%endif%>
<%if(macros)%>
add_compile_definitions(<%macros%>)
<%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} PUBLIC <%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%>)

<%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} PUBLIC <%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("
")%><%endfor%>)

<%endif%>
<%endfor%>
<%endif%>
<%endif%>
<%endfor%>
<%endif%>

<%marker(local)%>
<%marker(bottom)%>