diff --git a/CMakeLists.txt b/CMakeLists.txt index 619460744..ca7f6f73e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -635,6 +635,12 @@ if(NOT (GNURADIO_VERSION VERSION_LESS 3.8) AND LOG4CPP_READY_FOR_CXX17) # UHD 4.0.0.0 still does not support C++20 if((NOT UHD_FOUND) OR (UHD_FOUND AND ("${UHD_VERSION}" VERSION_LESS 3.99))) set(CMAKE_CXX_STANDARD 20) + if(CMAKE_VERSION VERSION_GREATER 3.20.99) + if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0")) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0"))) + set(CMAKE_CXX_STANDARD 23) + endif() + endif() endif() endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 75dd3e275..a8b2ff148 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -73,6 +73,7 @@ All notable changes to GNSS-SDR will be documented in this file. instead of using autotools. - Added support for Apple M1 AArch64 architecture processor and for FreeBSD on x86, improved AMD microarchitecture detection. +- CMake now selects the C++23 standard if the environment allows for it. ### Improvements in Reliability @@ -110,7 +111,7 @@ All notable changes to GNSS-SDR will be documented in this file. - Fix bug in searching for gr-iio when CMake was re-run several times with different settings for the `-DENABLE_FMCOMMS2` or `-DENABLE_PLUTOSDR` building options. -- Fix building when using UHD v4.0.0.0. +- Fix building when using UHD >= v4.0.0.0. - Fix building for `-DENABLE_FMCOMMS2=ON` and/or `-DENABLE_PLUTOSDR=ON` when the built-in gr-iio module introduced in GNU Radio 3.10 is found. This in-tree GNU Radio module takes precedence over the gr-iio package provided at diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 54dcf88cc..38c9d4284 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -134,6 +134,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_STANDARD 17) else() set(CMAKE_CXX_STANDARD 20) + if(CMAKE_VERSION VERSION_GREATER 3.20.99) + if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0")) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0"))) + set(CMAKE_CXX_STANDARD 23) + endif() + endif() endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) else()