From 9b37d1caf92b2f805c3d11bdb2063bf6711028e6 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Wed, 27 Oct 2021 16:09:59 +0200
Subject: [PATCH] Fix includes

---
 CMakeLists.txt                                |  5 +++-
 include/caosdb/constants.h.in                 |  4 +--
 .../caosdb/file_transmission/file_reader.h    |  1 +
 include/caosdb/protobuf_helper.h              |  5 ++--
 include/caosdb/utility.h                      | 26 +++++++++----------
 src/caosdb/configuration.cpp                  | 22 +++++++++-------
 .../download_request_handler.cpp              |  2 +-
 .../upload_request_handler.cpp                |  2 +-
 src/caosdb/transaction.cpp                    |  4 +--
 9 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d6ecf4..98d92a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,7 +45,10 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
 
 IF (WIN32)
     set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
-    set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+    set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
+    if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
+        set(CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}Debug")
+    endif()
     if(BUILD_SHARED_LIBS)
         set(CMAKE_MSVC_RUNTIME_LIBRARY "${CMAKE_MSVC_RUNTIME_LIBRARY}DLL")
     endif()
diff --git a/include/caosdb/constants.h.in b/include/caosdb/constants.h.in
index 72dc62a..fcc0f70 100644
--- a/include/caosdb/constants.h.in
+++ b/include/caosdb/constants.h.in
@@ -32,12 +32,12 @@ static const int LIBCAOSDB_VERSION_PATCH = @libcaosdb_VERSION_PATCH@;
 static const int COMPATIBLE_SERVER_VERSION_MAJOR = @libcaosdb_COMPATIBLE_SERVER_VERSION_MAJOR@;
 static const int COMPATIBLE_SERVER_VERSION_MINOR = @libcaosdb_COMPATIBLE_SERVER_VERSION_MINOR@;
 static const int COMPATIBLE_SERVER_VERSION_PATCH = @libcaosdb_COMPATIBLE_SERVER_VERSION_PATCH@;
-static const char* COMPATIBLE_SERVER_VERSION_PRE_RELEASE = "@libcaosdb_COMPATIBLE_SERVER_VERSION_PRE_RELEASE@";
+__attribute__((unused)) static const char* COMPATIBLE_SERVER_VERSION_PRE_RELEASE = "@libcaosdb_COMPATIBLE_SERVER_VERSION_PRE_RELEASE@";
 
 /**
  * Precedence of configuration files from highest to lowest.
  */
-static const char* LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE[] = {
+__attribute__((unused)) static const char* LIBCAOSDB_CONFIGURATION_FILES_PRECEDENCE[] = {
   "$CAOSDB_CLIENT_CONFIGURATION",
   "caosdb_client.json",
   "caosdb-client.json",
diff --git a/include/caosdb/file_transmission/file_reader.h b/include/caosdb/file_transmission/file_reader.h
index 2c52f17..14f8614 100644
--- a/include/caosdb/file_transmission/file_reader.h
+++ b/include/caosdb/file_transmission/file_reader.h
@@ -49,6 +49,7 @@
 #ifndef CAOSDB_FILE_TRANSMISSION_FILE_READER_H
 #define CAOSDB_FILE_TRANSMISSION_FILE_READER_H
 
+#include <cstddef>    // for size_t
 #include <filesystem> // for ifstream
 #include <fstream>    // for ifstream, size_t
 #include <string>     // for string
diff --git a/include/caosdb/protobuf_helper.h b/include/caosdb/protobuf_helper.h
index 4dfc11c..c111ac9 100644
--- a/include/caosdb/protobuf_helper.h
+++ b/include/caosdb/protobuf_helper.h
@@ -22,9 +22,8 @@
 #ifndef CAOSDB_PROTOBUF_HELPER_H
 #define CAOSDB_PROTOBUF_HELPER_H
 
-#include <google/protobuf/arena.h> // for Arena
-// IWYU pragma: no_include "google/protobuf/extension_set.h"
-// IWYU pragma: no_include "google/protobuf/generated_message_util.h"
+// IWYU pragma: no_include <google/protobuf/extension_set.h>
+#include <google/protobuf/arena.h>          // for Arena
 #include <google/protobuf/util/json_util.h> // for JsonOptions, MessageToJs...
 #include <string>                           // for string
 
diff --git a/include/caosdb/utility.h b/include/caosdb/utility.h
index 7f75594..0a4d65e 100644
--- a/include/caosdb/utility.h
+++ b/include/caosdb/utility.h
@@ -25,19 +25,19 @@
 #include "caosdb/entity.h"                    // for Importance, Role
 #include <boost/beast/core/detail/base64.hpp> // for encoded_size
 #include <boost/beast/core/detail/base64.ipp> // for encode
-#include <boost/filesystem.hpp>
-#include <boost/json/stream_parser.hpp> // for stream_parser
-#include <boost/json/value.hpp>         // for value
-#include <boost/lexical_cast.hpp>       // for lexical_cast
-#include <cassert>                      // for assert
-#include <cstdlib>                      // for getenv
-#include <filesystem>                   // for path
-#include <fstream>                      // for basic_istream<>::__ist...
-#include <memory>                       // for allocator, unique_ptr
-#include <stdexcept>                    // for logic_error
-#include <string>                       // for string, operator+, cha...
-#include <type_traits>                  // for underlying_type_t
-#include <typeinfo>                     // for type_info
+#include <boost/filesystem/string_file.hpp>   // for load_string_file
+#include <boost/json/stream_parser.hpp>       // for stream_parser
+#include <boost/json/value.hpp>               // for value
+#include <boost/lexical_cast.hpp>             // for lexical_cast
+#include <cassert>                            // for assert
+#include <cstdlib>                            // for getenv
+#include <filesystem>                         // for path
+#include <fstream>                            // for basic_istream<>::__ist...
+#include <memory>                             // for allocator, unique_ptr
+#include <stdexcept>                          // for logic_error
+#include <string>                             // for string, operator+, cha...
+#include <type_traits>                        // for underlying_type_t
+#include <typeinfo>                           // for type_info
 
 namespace caosdb::utility {
 using boost::json::stream_parser;
diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp
index dc09d3d..9a73204 100644
--- a/src/caosdb/configuration.cpp
+++ b/src/caosdb/configuration.cpp
@@ -19,15 +19,6 @@
  *
  */
 #include "caosdb/configuration.h"
-#include "boost/iterator/iterator_facade.hpp"          // for iterator_facad...
-#include "boost/json/impl/object.hpp"                  // for object::at
-#include "boost/json/string.hpp"                       // for string
-#include "boost/json/string_view.hpp"                  // for string_view
-#include "boost/log/core/record.hpp"                   // for record
-#include "boost/log/detail/attachable_sstream_buf.hpp" // for basic_ostring...
-#include "boost/log/sources/record_ostream.hpp"        // for basic_record_o...
-#include "boost/preprocessor/seq/limits/enum_256.hpp"  // for BOOST_PP_SEQ_E...
-#include "boost/preprocessor/seq/limits/size_256.hpp"  // for BOOST_PP_SEQ_S...
 #include "caosdb/authentication.h"                     // for Authenticator
 #include "caosdb/connection.h"                         // for ConnectionManager
 #include "caosdb/constants.h"                          // for LIBCAOSDB_CONF...
@@ -35,6 +26,18 @@
 #include "caosdb/log_level.h"                          // for CAOSDB_DEFAULT...
 #include "caosdb/status_code.h"                        // for StatusCode
 #include "caosdb/utility.h"                            // for get_home_direc...
+#include <boost/iterator/iterator_facade.hpp>          // for iterator_facad...
+#include <boost/json/impl/object.hpp>                  // for object::at
+#include <boost/json/object.hpp>                       // for object, objec...
+#include <boost/json/string.hpp>                       // for string
+#include <boost/json/string_view.hpp>                  // for string_view
+#include <boost/json/value.hpp>                        // for value, key_va...
+#include <boost/json/value_ref.hpp>                    // for object
+#include <boost/log/core/record.hpp>                   // for record
+#include <boost/log/detail/attachable_sstream_buf.hpp> // for basic_ostring...
+#include <boost/log/sources/record_ostream.hpp>        // for basic_record_o...
+#include <boost/preprocessor/seq/limits/enum_256.hpp>  // for BOOST_PP_SEQ_E...
+#include <boost/preprocessor/seq/limits/size_256.hpp>  // for BOOST_PP_SEQ_S...
 #include <cassert>                                     // for assert
 #include <cstdlib>                                     // for getenv
 #include <cstring>                                     // for strcmp
@@ -43,6 +46,7 @@
 #include <grpcpp/security/credentials.h> // for SslCredentials
 #include <iterator>                      // for next
 #include <map>                           // for map
+#include <sstream>                       // for basic_stringb...
 #include <stdexcept>                     // for out_of_range
 #include <string>                        // for string, operator+
 
diff --git a/src/caosdb/file_transmission/download_request_handler.cpp b/src/caosdb/file_transmission/download_request_handler.cpp
index 5887e53..dfe7d8b 100644
--- a/src/caosdb/file_transmission/download_request_handler.cpp
+++ b/src/caosdb/file_transmission/download_request_handler.cpp
@@ -65,7 +65,7 @@
 #include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue
 #include <grpcpp/impl/codegen/status.h>           // for Status
 #include <grpcpp/impl/codegen/status_code_enum.h> // for OK, UNAUTHENT...
-#include <iostream>                               // for char_traits
+#include <sstream>                                // for streamsize
 #include <stdexcept>                              // for runtime_error
 #include <string>                                 // for string, opera...
 #include <utility>                                // for move
diff --git a/src/caosdb/file_transmission/upload_request_handler.cpp b/src/caosdb/file_transmission/upload_request_handler.cpp
index f43448e..71f1106 100644
--- a/src/caosdb/file_transmission/upload_request_handler.cpp
+++ b/src/caosdb/file_transmission/upload_request_handler.cpp
@@ -68,7 +68,7 @@
 #include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue
 #include <grpcpp/impl/codegen/status.h>           // for Status
 #include <grpcpp/impl/codegen/status_code_enum.h> // for OK, UNAUTHENT...
-#include <iostream>                               // for endl, streamsize
+#include <sstream>                                // for streamsize
 #include <string>                                 // for basic_string
 #include <utility>                                // for move
 
diff --git a/src/caosdb/transaction.cpp b/src/caosdb/transaction.cpp
index 416d36f..8a1fe4a 100644
--- a/src/caosdb/transaction.cpp
+++ b/src/caosdb/transaction.cpp
@@ -39,10 +39,10 @@
 #include <google/protobuf/arena.h>                // for Arena
 #include <grpc/impl/codegen/gpr_types.h>          // for gpr_timespec
 #include <grpcpp/impl/codegen/completion_queue.h> // for CompletionQueue
-#include <iosfwd>                                 // for streamsize
 #include <map>                                    // for map, operator!=
 #include <memory>                                 // for unique_ptr
-#include <utility>                                // for move, pair
+#include <sstream>
+#include <utility> // for move, pair
 
 namespace caosdb::transaction {
 using caosdb::entity::v1alpha1::EntityTransactionService;
-- 
GitLab