Correctly propagate C++17 standard flags to NVCC compilation with older CMake versions. #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A user reported compilation issues for cuDecomp using the most recent NVHPC release (25.9) against CUDA 13.0. The root cause of their issue was a combination of an older GCC (earlier than GCC-10) and older CMake version (earlier than 3.18).
#72 bumped the required C++ standard to 17 to address deprecation warnings from
libcu++about C++14, which became a true compilation error in thelibcu++version packaged with CUDA 13. It turns out that CMake versions older than 3.18 do not propagate the C++17 flags (viaCMAKE_CXX_STANDARD=17) to.cufile compilation, likely becauseCMAKE_CUDA_STANDARDdoes not support C++17 until CMake 3.18 (ref). This doesn't matter if the GCC compiler is 10 or newer, as C++17 is the default standard applied and works in lieu of CMake providing the C++17 flags tonvcc, but breaks when the GCC is older and the default standard is pre-C++17.To address this, I am manually adding
-std=c++17toCMAKE_CUDA_FLAGSfor CMake versions prior to 3.18. While I could make the CMake minimum version 3.18, this would break builds on Ubuntu 20.04 which defaults to CMake 3.16.