Added c++17 flags to build functions

release/4.3a0
Frank Dellaert 2023-01-19 22:33:32 -08:00
parent a4367e1578
commit 0cb0733e33
2 changed files with 10 additions and 6 deletions

View File

@ -6,8 +6,6 @@ if(NOT DEFINED CMAKE_MACOSX_RPATH)
set(CMAKE_MACOSX_RPATH 0) set(CMAKE_MACOSX_RPATH 0)
endif() endif()
set(CMAKE_CXX_STANDARD 17)
# Set the version number for the library # Set the version number for the library
set (GTSAM_VERSION_MAJOR 4) set (GTSAM_VERSION_MAJOR 4)
set (GTSAM_VERSION_MINOR 3) set (GTSAM_VERSION_MINOR 3)

View File

@ -138,16 +138,22 @@ else()
set(GTSAM_COMPILE_OPTIONS_PRIVATE_TIMING -g -O3 CACHE STRING "(User editable) Private compiler flags for Timing configuration.") set(GTSAM_COMPILE_OPTIONS_PRIVATE_TIMING -g -O3 CACHE STRING "(User editable) Private compiler flags for Timing configuration.")
endif() endif()
# Enable C++11: # Enable C++17:
if (NOT CMAKE_VERSION VERSION_LESS 3.8) if (NOT CMAKE_VERSION VERSION_LESS 3.8)
set(GTSAM_COMPILE_FEATURES_PUBLIC "cxx_std_11" CACHE STRING "CMake compile features property for all gtsam targets.") set(GTSAM_COMPILE_FEATURES_PUBLIC "cxx_std_17" CACHE STRING "CMake compile features property for all gtsam targets.")
# See: https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html # See: https://cmake.org/cmake/help/latest/prop_tgt/CXX_EXTENSIONS.html
# This is to enable -std=c++11 instead of -std=g++11 # TODO(dellaert): is following line still needed or was that only for c++11?
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
if (MSVC)
# NOTE(jlblanco): seems to be required in addition to the cxx_std_17 above?
# TODO(dellaert): is this the right syntax below?
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC /std:c++latest)
endif()
else() else()
# Old cmake versions: # Old cmake versions:
if (NOT MSVC) if (NOT MSVC)
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=c++11>) # TODO(dellaert): I just changed 11 to 17 below, hopefully that works
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-std=c++17>)
endif() endif()
endif() endif()