前言
在公司做项目都是看懂项目的构建体系就可以,最多就是在上面稍加改动,现在想尝试一下自己从无到有构建一个完整的工程
1.代码的物理结构
2.源代码内容
hello.h:
#ifndef HELLO_INC_HELLO_H_
#define HELLO_INC_HELLO_H_
#include <string>
struct Hello
{
Hello(std::string output) : output(output) {}
void outputStr();
private:
std::string output;
};
#endif
hello.cpp
#include "hello.h"
#include <iostream>
void Hello::outputStr()
{
std::cout << output << std::endl;
}
main.cpp
#include "hello.h"
int main(int argc, char *argv[])
{
Hello hello{"222"};
hello.outputStr();
}
3.CMakeLists.txt内容
ft目录下的CmakeLists
cm