MCPcopy Create free account
hub / github.com/GENIVI/CANdevStudio / genCMake

Function genCMake

tools/templategen/main.cpp:20–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20std::string genCMake(const std::string name)
21{
22 using namespace fmt::literals;
23
24 return fmt::format(R"(set(COMPONENT_NAME {name})
25
26set(SRC
27 {name}.cpp
28 {name}_p.cpp
29 {name}model.cpp
30)
31
32add_library(${{COMPONENT_NAME}} ${{SRC}})
33target_link_libraries(${{COMPONENT_NAME}} Qt5::Widgets Qt5::Core Qt5::SerialBus nodes cds-common)
34target_include_directories(${{COMPONENT_NAME}} INTERFACE ${{CMAKE_CURRENT_SOURCE_DIR}})
35
36if(WITH_TESTS)
37 add_executable(${{COMPONENT_NAME}}_test tests/${{COMPONENT_NAME}}_test.cpp)
38 target_link_libraries(${{COMPONENT_NAME}}_test ${{COMPONENT_NAME}} Qt5::Test fakeit)
39 add_test(NAME ${{COMPONENT_NAME}}_test COMMAND ${{COMPONENT_NAME}}_test)
40
41 add_executable(${{COMPONENT_NAME}}model_test tests/${{COMPONENT_NAME}}model_test.cpp)
42 target_link_libraries(${{COMPONENT_NAME}}model_test ${{COMPONENT_NAME}} Qt5::Test fakeit)
43 add_test(NAME ${{COMPONENT_NAME}}model_test COMMAND ${{COMPONENT_NAME}}model_test)
44endif()
45)",
46 "name"_a = name);
47}
48
49std::string genComponentHdr(const std::string& name)
50{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected