diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f171394fc7..3f14c3b42bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,12 +2,22 @@ cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR) # Set target C++ standard and required compiler features -set(CMAKE_CXX_STANDARD 14 CACHE STRING "The target C++ standard. PCL requires C++14 or higher.") +set(CMAKE_CXX_STANDARD 17 CACHE STRING "The target C++ standard. PCL requires C++14 or higher.") set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(PCL_CXX_COMPILE_FEATURES cxx_std_14) +if("${CMAKE_CXX_STANDARD}" GREATER_EQUAL 17) + set(PCL_CXX_COMPILE_FEATURES cxx_std_17) + set(PCL__cplusplus 201703L) + set(PCL_REQUIRES_MSC_VER 1912) +elseif("${CMAKE_CXX_STANDARD}" EQUAL 14) + set(PCL_CXX_COMPILE_FEATURES cxx_std_14) + set(PCL__cplusplus 201402L) + set(PCL_REQUIRES_MSC_VER 1900) +else() + message(FATAL_ERROR "Unknown or unsupported C++ standard specified") +endif() -set(CMAKE_CUDA_STANDARD 14 CACHE STRING "The target CUDA/C++ standard. PCL requires CUDA/C++ 14 or higher.") +set(CMAKE_CUDA_STANDARD 17 CACHE STRING "The target CUDA/C++ standard. PCL requires CUDA/C++ 14 or higher.") set(CMAKE_CUDA_STANDARD_REQUIRED ON) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "possible configurations" FORCE) diff --git a/pcl_config.h.in b/pcl_config.h.in index 2be34b19b9f..5b07e0d7ca0 100644 --- a/pcl_config.h.in +++ b/pcl_config.h.in @@ -3,8 +3,8 @@ // Ensure the compiler is meeting the minimum C++ standard // MSVC is not checked via __cplusplus due to // https://developercommunity.visualstudio.com/content/problem/120156/-cplusplus-macro-still-defined-as-pre-c11-value.html -#if defined(__cplusplus) && ((!defined(_MSC_VER) && __cplusplus < 201402L) || (defined(_MSC_VER) && _MSC_VER < 1900)) - #error PCL requires C++14 or above +#if defined(__cplusplus) && ((!defined(_MSC_VER) && __cplusplus < ${PCL__cplusplus}) || (defined(_MSC_VER) && _MSC_VER < ${PCL_REQUIRES_MSC_VER}) || (defined(_MSVC_LANG) && _MSVC_LANG < ${PCL__cplusplus})) + #error C++ standard too low (PCL requires ${PCL__cplusplus} or above) #endif #define BUILD_@CMAKE_BUILD_TYPE@ diff --git a/test/fuzz/build.sh b/test/fuzz/build.sh index 747809f7e7e..ccf53d86322 100644 --- a/test/fuzz/build.sh +++ b/test/fuzz/build.sh @@ -54,7 +54,7 @@ $CXX $CXXFLAGS -DPCLAPI_EXPORTS \ -I/src/pcl/build/include -I/src/pcl/common/include \ -I/src/pcl/dssdk/include \ -I/src/pcl/io/include -isystem /usr/include/eigen3 \ - -O2 -g -DNDEBUG -fPIC -std=c++14 \ + -O2 -g -DNDEBUG -fPIC -std=c++17 \ -o ply_reader_fuzzer.o -c ply_reader_fuzzer.cpp $CXX $CXXFLAGS $LIB_FUZZING_ENGINE ply_reader_fuzzer.o \