diff --git a/CMakeLists.txt b/CMakeLists.txt index 168c3aba1ca..e4dbef8ec17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,6 +220,10 @@ if(CMAKE_COMPILER_IS_MSVC) string(APPEND CMAKE_C_FLAGS " /FS") string(APPEND CMAKE_CXX_FLAGS " /FS") endif() + + if(MSVC_VERSION GREATER_EQUAL 1914) + string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus") + endif() endif() if(CMAKE_COMPILER_IS_PATHSCALE) diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 4dd18517e85..cc60d1e39f6 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -452,9 +452,8 @@ set(PCL_SHARED_LIBS "@PCL_SHARED_LIBS@") #set SSE flags used compiling PCL list(APPEND PCL_DEFINITIONS @PCLCONFIG_SSE_DEFINITIONS@) list(APPEND PCL_COMPILE_OPTIONS @PCLCONFIG_SSE_COMPILE_OPTIONS@) - -#set AVX flags used compiling PCL list(APPEND PCL_COMPILE_OPTIONS @PCLCONFIG_AVX_COMPILE_OPTIONS@) +list(APPEND PCL_COMPILE_OPTIONS @PCLCONFIG_COMPILE_OPTIONS@) set(pcl_all_components @PCLCONFIG_AVAILABLE_COMPONENTS@) # insert "io_ply" before "io" diff --git a/cmake/pcl_pclconfig.cmake b/cmake/pcl_pclconfig.cmake index f9941b14355..b4d128acadb 100644 --- a/cmake/pcl_pclconfig.cmake +++ b/cmake/pcl_pclconfig.cmake @@ -15,6 +15,11 @@ set(PCLCONFIG_OPTIONAL_DEPENDENCIES) set(PCLCONFIG_SSE_DEFINITIONS "${SSE_DEFINITIONS}") set(PCLCONFIG_SSE_COMPILE_OPTIONS ${SSE_FLAGS}) set(PCLCONFIG_AVX_COMPILE_OPTIONS ${AVX_FLAGS}) +set(PCLCONFIG_COMPILE_OPTIONS) + +if(MSVC AND MSVC_VERSION GREATER_EQUAL 1914) + list(APPEND PCLCONFIG_COMPILE_OPTIONS "/Zc:__cplusplus") +endif() # Eigen has a custom mechanism to guarantee aligned memory (used for everything older than C++17, see Memory.h in the Eigen project) # If PCL is compiled with C++14 and the user project is compiled with C++17, this will lead to problems (e.g. memory allocated with the custom mechanism but freed without it)