  set_target_properties(${PROJECT_NAME} PROPERTIES
    COMPILE_FLAGS ${TARGET_COMPILE_FLAGS})
  
+diff --git a/cmake/functions.cmake b/cmake/functions.cmake
+index c6ec093..f6927ec 100644
+--- a/cmake/functions.cmake
++++ b/cmake/functions.cmake
+@@ -72,7 +72,7 @@ macro(google_initialize_cartographer_project)
+     set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
+         ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+   endif()
+-  set(GOOG_CXX_FLAGS "-pthread -std=c++11 -fPIC ${GOOG_CXX_FLAGS}")
++  set(GOOG_CXX_FLAGS "-pthread -fPIC ${GOOG_CXX_FLAGS}")
+ 
+   google_add_flag(GOOG_CXX_FLAGS "-Wall")
+   google_add_flag(GOOG_CXX_FLAGS "-Wpedantic")

From 12d4c2e941d85a085b98a3e19b68d263ff8a5dd5 Mon Sep 17 00:00:00 2001
From: Martin Jansa <martin.jansa@lge.com>
Date: Wed, 17 Feb 2021 17:30:59 +0000
Subject: [PATCH] CmakeLists.txt: set C++ version to C++14

  without it, cartographer build fails with a lot of errors like:
  error: 'integer_sequence' is not a member of 'std'

* set CMAKE_CXX_EXTENSIONS as well, because with CMake-3.22.0:
  https://github.com/Kitware/CMake/commit/fc3a1cbdd81f350b897c6cd06d75e8e228514773
  -std=gnu++17 gets added to FLAGS in build/build.ninja causing
  various build failures like:

FAILED: CMakeFiles/cartographer_ros.dir/cartographer_ros/time_conversion.cc.o
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot-native/usr/bin/x86_64-webos-linux/x86_64-webos-linux-g++ -DCERES_EXPORT_INTERNAL_SYMBOLS -DDEFAULT_RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -DURDFDOM_HEADERS_HAS_SHARED_PTR_DEFS -I/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/include -I/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/. -I/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/build -I/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/pcl-1.10 -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/eigen3 -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/cairo -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/glib-2.0 -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/lib/glib-2.0/include -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/pixman-1 -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/uuid -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/freetype2 -isystem /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/libpng16 -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type  --sysroot=/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0=/usr/src/debug/cartographer-ros/1.0.9003-4-r0                      -fdebug-prefix-map=/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0=/usr/src/debug/cartographer-ros/1.0.9003-4-r0                      -fdebug-prefix-map=/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot=                      -fdebug-prefix-map=/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot-native=  -fvisibility-inlines-hidden   -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type  --sysroot=/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot -DNDEBUG  -pthread -std=c++11 -fPIC  -Wall -Wpedantic -Werror=format-security -Werror=missing-braces -Werror=reorder -Werror=return-type -Werror=switch -O3 -DNDEBUG -Wall -Wextra -MD -MT CMakeFiles/cartographer_ros.dir/cartographer_ros/time_conversion.cc.o -MF CMakeFiles/cartographer_ros.dir/cartographer_ros/time_conversion.cc.o.d -o CMakeFiles/cartographer_ros.dir/cartographer_ros/time_conversion.cc.o -c /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/cartographer_ros/time_conversion.cc
In file included from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/detail/time__struct.hpp:8,
                 from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/time.hpp:7,
                 from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/./cartographer_ros/time_conversion.h:21,
                 from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/cartographer_ros/time_conversion.cc:17:
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/rosidl_runtime_cpp/bounded_vector.hpp:477:3: error: 'emplace_back' function uses 'auto' type specifier without trailing return type
  477 |   auto
      |   ^~~~
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/rosidl_runtime_cpp/bounded_vector.hpp:477:3: note: deduced return type only available with '-std=c++14' or '-std=gnu++14'
In file included from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/time.hpp:8,
                 from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/./cartographer_ros/time_conversion.h:21,
                 from /jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/git/cartographer_ros/time_conversion.cc:17:
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/detail/time__builder.hpp:60:1: error: 'build' function uses 'auto' type specifier without trailing return type
   60 | auto build();
      | ^~~~
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/detail/time__builder.hpp:60:1: note: deduced return type only available with '-std=c++14' or '-std=gnu++14'
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/detail/time__builder.hpp:64:1: error: 'build' function uses 'auto' type specifier without trailing return type
   64 | auto build<::builtin_interfaces::msg::Time>()
      | ^~~~
/jenkins/mjansa/build/ros/webos-rolling-kirkstone/tmp-glibc/work/qemux86_64-webos-linux/cartographer-ros/1.0.9003-4-r0/recipe-sysroot/usr/include/builtin_interfaces/msg/detail/time__builder.hpp:64:1: note: deduced return type only available with '-std=c++14' or '-std=gnu++14'

Upstream-Status: Pending

Signed-off-by: Martin Jansa <martin.jansa@lge.com>
---
 CMakeLists.txt        | 4 +++-
 cmake/functions.cmake | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf040c6..67217d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,8 @@ google_initialize_cartographer_project()
 google_enable_testing()
 
 find_package(Boost REQUIRED COMPONENTS iostreams)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_EXTENSIONS 14)
 find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
 find_package(Eigen3 REQUIRED)
 find_package(LuaGoogle REQUIRED)
@@ -235,7 +237,7 @@ if(${BUILD_PROMETHEUS})
   target_compile_definitions(${PROJECT_NAME} PUBLIC USE_PROMETHEUS=1)
 endif()
 
