1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 19:20:32 +00:00

Select C++23 if the environment allows for it

CMake >= 3.21, GCC >= 11, Clang >= 12, UHD < 4.0
This commit is contained in:
Carles Fernandez 2021-07-27 21:18:26 +02:00
parent ce49384004
commit 5f90820be8
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 14 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -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()