带有单元测试的仅标头库的现代CMake项目

时间:2019-09-13 07:32:57

标签: c++ unit-testing cmake

我正在开发使用C ++ 17功能的仅标头库。项目结构如下:

(a,a,...,a)

单元测试使用doctest单元测试框架,我目前未将其包含在项目中。

我的主CMakeLists.txt文件和单元测试CMakeLists.txt文件应该如何:

  • 使客户端使用C ++ 17(或更高版本)语言标准,因为库使用a
  • 启用生成漂亮的IDE项目(我正在使用Visual Studio 2017)
  • 以尽可能与编译器无关的方式启用Cons F a = (a, F a) = (a, (a,a....)) { 1 + N a's , as wanted } public function getWordtoPDF(){ $domPdfPath = base_path('vendor/dompdf/dompdf'); \PhpOffice\PhpWord\Settings::setPdfRendererPath($domPdfPath); \PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF'); //Load word file $Content = \PhpOffice\PhpWord\IOFactory::load(public_path('TempDownload/Test.docx')); //Save it into PDF $PDFWriter = \PhpOffice\PhpWord\IOFactory::createWriter($Content,'PDF'); $PDFWriter->save('result3.pdf'); exit; } - project - README.md - LICENSE.md - CMakeLists.txt - include - proj_library.h - test - unittest - CMakeLists.txt - main.cpp - test.cpp 选项的等效功能(我计划至少使用GCC,Clang和VS 2017进行编译)

到目前为止,我有这个,我基于几个开源项目和文章:

主要CMakeLists.txt:

std::optional

单元测试CMakeLists.txt:

-Wall

当前,在开发库时,我不需要安装等类似的目标。我只需要在多个平台上构建单元测试的设施。

有什么建议吗?

0 个答案:

没有答案