diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b6d1ebaa..16993735a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,6 @@ else() include(cmake/conan_build.cmake) endif() - ############################################################# # LIBRARY @@ -187,6 +186,7 @@ target_compile_definitions(${BTCPP_LIBRARY} PUBLIC BTCPP_LIBRARY_VERSION="${CMAK target_compile_features(${BTCPP_LIBRARY} PUBLIC cxx_std_17) if(MSVC) + target_compile_options(${BTCPP_LIBRARY} PRIVATE "/source-charset:utf-8") else() target_compile_options(${BTCPP_LIBRARY} PRIVATE -Wall -Wextra) endif() diff --git a/src/xml_parsing.cpp b/src/xml_parsing.cpp index b74b1ddb4..2e950e4d9 100644 --- a/src/xml_parsing.cpp +++ b/src/xml_parsing.cpp @@ -19,6 +19,12 @@ #include #include +#if defined(_MSVC_LANG) && !defined(__clang__) +#define __bt_cplusplus (_MSC_VER == 1900 ? 201103L : _MSVC_LANG) +#else +#define __bt_cplusplus __cplusplus +#endif + #if defined(__linux) || defined(__linux__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" @@ -254,7 +260,12 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes) break; } - std::filesystem::path file_path(incl_node->Attribute("path")); +#if __bt_cplusplus >= 202002L + auto file_path(std::filesystem::path(incl_node->Attribute("path"))); +#else + auto file_path(std::filesystem::u8path(incl_node->Attribute("path"))); +#endif + const char* ros_pkg_relative_path = incl_node->Attribute("ros_pkg"); if(ros_pkg_relative_path)