Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ cmake_minimum_required(VERSION 3.16.3 FATAL_ERROR)
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)
if("${CMAKE_CXX_STANDARD}" GREATER_EQUAL 17)
set(PCL_CXX_COMPILE_FEATURES cxx_std_17)
if("${CMAKE_CXX_STANDARD}" GREATER_EQUAL 20)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition GREATER_EQUAL 20 will match C++ standards beyond C++20 (such as C++23, C++26, etc.), but sets C++20-specific values for PCL__cplusplus (202002L) and PCL_REQUIRES_MSC_VER (1928). This creates an inconsistency: if a user sets CMAKE_CXX_STANDARD to 23, line 21 would set PCL_CXX_COMPILE_FEATURES to cxx_std_23, but PCL__cplusplus would remain at the C++20 value (202002L). This could cause incorrect compiler version checks in pcl_config.h.in. Consider either changing to EQUAL 20 with additional conditions for newer standards, or update the values to be appropriate for the highest standard being checked.

Suggested change
if("${CMAKE_CXX_STANDARD}" GREATER_EQUAL 20)
if("${CMAKE_CXX_STANDARD}" EQUAL 20)

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one we can just leave as is. PCL__cplusplus is only used to check for a minimum requirement.

set(PCL__cplusplus 202002L)
set(PCL_REQUIRES_MSC_VER 1928)
elseif("${CMAKE_CXX_STANDARD}" EQUAL 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 17 CACHE STRING "The target CUDA/C++ standard. PCL requires CUDA/C++ 14 or higher.")
set(PCL_CXX_COMPILE_FEATURES cxx_std_${CMAKE_CXX_STANDARD})
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMAKE_CUDA_STANDARD is no longer defined as a CACHE variable. While the PR description explains this enforces synchronization with CMAKE_CXX_STANDARD to prevent compilation issues, this is a breaking change for users who were previously setting CMAKE_CUDA_STANDARD separately via CMake command line (e.g., -DCMAKE_CUDA_STANDARD=20). Their setting will now be ignored. Consider documenting this breaking change in release notes or migration guides, or alternatively, implementing a check that warns users if they attempt to set CMAKE_CUDA_STANDARD to a different value than CMAKE_CXX_STANDARD.

Suggested change
set(PCL_CXX_COMPILE_FEATURES cxx_std_${CMAKE_CXX_STANDARD})
set(PCL_CXX_COMPILE_FEATURES cxx_std_${CMAKE_CXX_STANDARD})
# Warn users if they attempted to set CMAKE_CUDA_STANDARD independently; it is
# intentionally synchronized with CMAKE_CXX_STANDARD in this project.
if(DEFINED CMAKE_CUDA_STANDARD AND NOT CMAKE_CUDA_STANDARD STREQUAL "${CMAKE_CXX_STANDARD}")
message(WARNING
"CMAKE_CUDA_STANDARD is synchronized with CMAKE_CXX_STANDARD in this project. "
"The provided CMAKE_CUDA_STANDARD ('${CMAKE_CUDA_STANDARD}') will be ignored in "
"favor of CMAKE_CXX_STANDARD='${CMAKE_CXX_STANDARD}'.")
endif()

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one we could consider adding.

set(CMAKE_CUDA_STANDARD ${CMAKE_CXX_STANDARD})
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "possible configurations" FORCE)
Expand Down