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.
This commit is contained in:
yyc12345 2024-06-06 13:16:55 +08:00
parent 642db411f5
commit 019034a9c2
3 changed files with 15 additions and 10 deletions

View File

@ -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

View File

@ -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
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
)
# Install binary
install(TARGETS Testbench
EXPORT TestbenchTargets
install(TARGETS YYCCTestbench
EXPORT YYCCTestbenchTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin

View File

@ -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);