From 019034a9c26845b165671d55b32f1a3744e41821 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 6 Jun 2024 13:16:55 +0800 Subject: [PATCH] chore: update CMakeLists.txt - update CMakeLists.txt. Add an option to disable the generation of testbench. - rename testbench name to YYCCTestbench. - allow emoji test in code. --- CMakeLists.txt | 7 ++++++- testbench/CMakeLists.txt | 16 ++++++++-------- testbench/main.cpp | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be8baae..e1e4d0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,14 @@ project(YYCC LANGUAGES CXX ) +# Provide options +option(YYCC_BUILD_TESTBENCH "Build testbench of YYCCommonplace." OFF) + # Import 2 build targets add_subdirectory(src) -add_subdirectory(testbench) +if (YYCC_BUILD_TESTBENCH) + add_subdirectory(testbench) +endif () # Install project package infos # Package target diff --git a/testbench/CMakeLists.txt b/testbench/CMakeLists.txt index 811715e..cbbc08d 100644 --- a/testbench/CMakeLists.txt +++ b/testbench/CMakeLists.txt @@ -1,35 +1,35 @@ # Create executable testbench -add_executable(Testbench "") +add_executable(YYCCTestbench "") # Setup testbench sources -target_sources(Testbench +target_sources(YYCCTestbench PRIVATE ${CMAKE_CURRENT_LIST_DIR}/main.cpp ) # Add YYCC as its library -target_include_directories(Testbench +target_include_directories(YYCCTestbench PRIVATE YYCCommonplace ) -target_link_libraries(Testbench +target_link_libraries(YYCCTestbench PRIVATE YYCCommonplace ) # Setup C++ standard -set_target_properties(Testbench +set_target_properties(YYCCTestbench PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED 17 CXX_EXTENSION OFF ) # Order build as UTF-8 in MSVC -target_compile_options(Testbench +target_compile_options(YYCCTestbench PRIVATE $<$:/utf-8> ) # Install binary -install(TARGETS Testbench - EXPORT TestbenchTargets +install(TARGETS YYCCTestbench + EXPORT YYCCTestbenchTargets LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin diff --git a/testbench/main.cpp b/testbench/main.cpp index 2996234..0fcb0a2 100644 --- a/testbench/main.cpp +++ b/testbench/main.cpp @@ -29,7 +29,7 @@ namespace Testbench { "fran\u00E7ais langue \u00E9trang\u00E8re", // FRANCE "ma\u00F1ana ol\u00E9", // SPAIN "\u222E E\u22C5da = Q, n \u2192 \u221E, \u2211 f(i) = \u220F g(i)", // MATHMATICS - //"\xF0\x9F\x8D\xA3 \xE2\x9C\x96 \xF0\x9F\x8D\xBA", // EMOJI + "\xF0\x9F\x8D\xA3 \xE2\x9C\x96 \xF0\x9F\x8D\xBA", // EMOJI }; for (const auto* ptr : c_TestStrings) { YYCC::ConsoleHelper::FPrintf(stdout, "\t%s\n", ptr);