From 3831e387a9d1102da1bad9eabbc80de384d45fe6 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 22 Oct 2023 14:45:18 -0400 Subject: [PATCH 1/2] indentlog: need unique cmake targets across xo for submodule build --- CMakeLists.txt | 8 ++++---- example/ex1/CMakeLists.txt | 4 ++-- example/ex2/CMakeLists.txt | 6 ++++-- example/ex3/CMakeLists.txt | 4 ++-- example/ex4/CMakeLists.txt | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6799082..65572cc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,7 @@ xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets # ---------------------------------------------------------------- install(TARGETS hello DESTINATION bin/indentlog/example) -install(TARGETS ex1 DESTINATION bin/indentlog/example) -install(TARGETS ex2 DESTINATION bin/indentlog/example) -install(TARGETS ex3 DESTINATION bin/indentlog/example) -install(TARGETS ex4 DESTINATION bin/indentlog/example) +install(TARGETS indentlog_ex1 DESTINATION bin/indentlog/example) +install(TARGETS indentlog_ex2 DESTINATION bin/indentlog/example) +install(TARGETS indentlog_ex3 DESTINATION bin/indentlog/example) +install(TARGETS indentlog_ex4 DESTINATION bin/indentlog/example) diff --git a/example/ex1/CMakeLists.txt b/example/ex1/CMakeLists.txt index a9d1b27d..f42c56de 100644 --- a/example/ex1/CMakeLists.txt +++ b/example/ex1/CMakeLists.txt @@ -1,2 +1,2 @@ -add_executable(ex1 ex1.cpp) -xo_include_options2(ex1) +add_executable(indentlog_ex1 ex1.cpp) +xo_include_options2(indentlog_ex1) diff --git a/example/ex2/CMakeLists.txt b/example/ex2/CMakeLists.txt index 20026b03..2dc39192 100644 --- a/example/ex2/CMakeLists.txt +++ b/example/ex2/CMakeLists.txt @@ -1,2 +1,4 @@ -add_executable(ex2 ex2.cpp) -xo_include_options2(ex2) +# NOTE: need target names to be globally unique within the xo umbrella + +add_executable(indentlog_ex2 ex2.cpp) +xo_include_options2(indentlog_ex2) diff --git a/example/ex3/CMakeLists.txt b/example/ex3/CMakeLists.txt index 9791a931..bb5110ce 100644 --- a/example/ex3/CMakeLists.txt +++ b/example/ex3/CMakeLists.txt @@ -1,2 +1,2 @@ -add_executable(ex3 ex3.cpp) -xo_include_options2(ex3) +add_executable(indentlog_ex3 ex3.cpp) +xo_include_options2(indentlog_ex3) diff --git a/example/ex4/CMakeLists.txt b/example/ex4/CMakeLists.txt index 2a6b9c31..6ff720f7 100644 --- a/example/ex4/CMakeLists.txt +++ b/example/ex4/CMakeLists.txt @@ -1,2 +1,2 @@ -add_executable(ex4 ex4.cpp) -xo_include_options2(ex4) +add_executable(indentlog_ex4 ex4.cpp) +xo_include_options2(indentlog_ex4) From 86fb63c6794e9dd9d4abfb10a247b48f737bb8b9 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 22 Oct 2023 20:39:54 -0400 Subject: [PATCH 2/2] bugfix: drop std::move to allow copy elisison --- include/xo/indentlog/log_state.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xo/indentlog/log_state.hpp b/include/xo/indentlog/log_state.hpp index d7bec9ae..29ad0dda 100644 --- a/include/xo/indentlog/log_state.hpp +++ b/include/xo/indentlog/log_state.hpp @@ -347,7 +347,7 @@ namespace xo { ss << code_location(this->file_, this->line_, log_config::code_location_color); - std::string ss_str = std::move(ss.str()); /*c++20*/ + std::string ss_str = ss.str(); /*hoping for copy elision here*/ sbuf2->sputn(ss_str.c_str(), ss_str.size()); this->location_flag_ = false;