58 lines
2.1 KiB
C++
58 lines
2.1 KiB
C++
|
//this file is generated by program(drogon_ctl) automatically,don't modify it!
|
||
|
#include "test_cmake.h"
|
||
|
#include <drogon/utils/OStringStream.h>
|
||
|
#include <string>
|
||
|
#include <map>
|
||
|
#include <vector>
|
||
|
#include <set>
|
||
|
#include <iostream>
|
||
|
#include <unordered_map>
|
||
|
#include <unordered_set>
|
||
|
#include <algorithm>
|
||
|
#include <list>
|
||
|
#include <deque>
|
||
|
#include <queue>
|
||
|
using namespace drogon;
|
||
|
std::string test_cmake::genText(const DrTemplateData& test_cmake_view_data)
|
||
|
{
|
||
|
drogon::OStringStream test_cmake_tmp_stream;
|
||
|
std::string layoutName{""};
|
||
|
test_cmake_tmp_stream << "cmake_minimum_required(VERSION 3.5)\n";
|
||
|
test_cmake_tmp_stream << "project(";
|
||
|
{
|
||
|
auto & val=test_cmake_view_data["ProjectName"];
|
||
|
if(val.type()==typeid(const char *)){
|
||
|
test_cmake_tmp_stream<<*any_cast<const char *>(&val);
|
||
|
}else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){
|
||
|
test_cmake_tmp_stream<<*any_cast<const std::string>(&val);
|
||
|
}
|
||
|
}
|
||
|
test_cmake_tmp_stream << "_test CXX)\n";
|
||
|
test_cmake_tmp_stream<<"\n";
|
||
|
test_cmake_tmp_stream << "add_executable(${PROJECT_NAME} test_main.cc)\n";
|
||
|
test_cmake_tmp_stream<<"\n";
|
||
|
test_cmake_tmp_stream << "# ##############################################################################\n";
|
||
|
test_cmake_tmp_stream << "# If you include the drogon source code locally in your project, use this method\n";
|
||
|
test_cmake_tmp_stream << "# to add drogon \n";
|
||
|
test_cmake_tmp_stream << "# target_link_libraries(${PROJECT_NAME}_test PRIVATE drogon)\n";
|
||
|
test_cmake_tmp_stream << "#\n";
|
||
|
test_cmake_tmp_stream << "# and comment out the following lines\n";
|
||
|
test_cmake_tmp_stream << "target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon)\n";
|
||
|
test_cmake_tmp_stream<<"\n";
|
||
|
test_cmake_tmp_stream << "ParseAndAddDrogonTests(${PROJECT_NAME})\n";
|
||
|
if(layoutName.empty())
|
||
|
{
|
||
|
std::string ret{std::move(test_cmake_tmp_stream.str())};
|
||
|
return ret;
|
||
|
}else
|
||
|
{
|
||
|
auto templ = DrTemplateBase::newTemplate(layoutName);
|
||
|
if(!templ) return "";
|
||
|
HttpViewData data = test_cmake_view_data;
|
||
|
auto str = std::move(test_cmake_tmp_stream.str());
|
||
|
if(!str.empty() && str[str.length()-1] == '\n') str.resize(str.length()-1);
|
||
|
data[""] = std::move(str);
|
||
|
return templ->genText(data);
|
||
|
}
|
||
|
}
|