From 81a2fc9d996e1ca8420e30fad12435d37362c078 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 30 Jan 2023 11:24:39 +0000 Subject: [PATCH] ECC-1508: Set project language to be C++ --- CMakeLists.txt | 5 ++++- INSTALL | 4 ++-- tests/CMakeLists.txt | 8 ++++---- tools/big2gribex.cpp | 2 +- tools/gts_dump.cpp | 2 +- tools/metar_dump.cpp | 2 +- tools/metar_ls.cpp | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 377d44349..2bf3fe293 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ find_package( ecbuild 3.7 REQUIRED HINTS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CUR # Initialise project project( eccodes VERSION 2.29.0 LANGUAGES CXX ) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + ############################################################################### # system checks needed for eccodes_config.h and some options like MEMFS @@ -68,7 +71,7 @@ ecbuild_info("Operating system=${CMAKE_SYSTEM} (${EC_OS_BITS} bits)") if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) ecbuild_add_cxx_flags("-Wno-write-strings -Wno-deprecated") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - ecbuild_add_cxx_flags("-Wno-deprecated") + ecbuild_add_cxx_flags("-Wno-write-strings -Wno-deprecated") elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Cray" ) set(CMAKE_CXX_FLAGS "-hstd=c++11 ${CMAKE_CXX_FLAGS}") endif() diff --git a/INSTALL b/INSTALL index e74cf260d..802e3cc22 100644 --- a/INSTALL +++ b/INSTALL @@ -45,8 +45,8 @@ You can also pass options to the cmake command above. Some typical examples are: -DENABLE_ECCODES_THREADS=ON Enable POSIX threads -DENABLE_JPG=ON Enable JPEG encoding/decoding (for GRIB packing) -DCMAKE_Fortran_COMPILER=pgf90 Set Fortran compiler to Portland Group F90 compiler - -DCMAKE_C_FLAGS="-O2 -Wall" Prepend the specified flags at the front - of the compilation command for C source files + -DCMAKE_CXX_FLAGS="-O2 -Wall" Prepend the specified flags at the front + of the compilation command for C++ source files By default the ctest step above does NOT require any data to be downloaded and only runs basic sanity tests. However if you wish to exercise more of the functionality of ecCodes, you are advised to configure the build with: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e62e2ee1b..11ad25254 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -32,7 +32,7 @@ list(APPEND test_c_bins grib_optimize_scaling_sh grib_set_force grib_ecc-386 - # grib_ecc-1431 + grib_ecc-1431 bufr_ecc-517 bufr_ecc-1288 bufr_get_element @@ -271,9 +271,9 @@ if( HAVE_BUILD_TOOLS ) codes_split_file grib_mars_keys) - #if( HAVE_AEC AND ENABLE_EXTRA_TESTS ) - # list(APPEND tests_extra grib_ecc-1431) - #endif() + if( HAVE_AEC AND ENABLE_EXTRA_TESTS ) + list(APPEND tests_extra grib_ecc-1431) + endif() if( HAVE_FORTRAN AND ENABLE_EXTRA_TESTS ) list(APPEND tests_extra bufr_dump_encode_fortran) list(APPEND tests_extra bufr_dump_decode_fortran) diff --git a/tools/big2gribex.cpp b/tools/big2gribex.cpp index 059ad6988..a36b01126 100644 --- a/tools/big2gribex.cpp +++ b/tools/big2gribex.cpp @@ -9,7 +9,7 @@ */ /* - * C Implementation: big2gribex + * Implementation: big2gribex * * Description: * diff --git a/tools/gts_dump.cpp b/tools/gts_dump.cpp index b33831ef0..0f297393b 100644 --- a/tools/gts_dump.cpp +++ b/tools/gts_dump.cpp @@ -9,7 +9,7 @@ */ /* - * C Implementation: gts_dump + * Implementation: gts_dump * * */ diff --git a/tools/metar_dump.cpp b/tools/metar_dump.cpp index 080ec8ea3..4e0e2b8d4 100644 --- a/tools/metar_dump.cpp +++ b/tools/metar_dump.cpp @@ -9,7 +9,7 @@ */ /* - * C Implementation: grib_dump + * Implementation: grib_dump * * Author: Enrico Fucile * diff --git a/tools/metar_ls.cpp b/tools/metar_ls.cpp index ebb160c80..794438715 100644 --- a/tools/metar_ls.cpp +++ b/tools/metar_ls.cpp @@ -9,7 +9,7 @@ */ /* - * C Implementation: grib_ls + * Implementation: grib_ls * * Author: Enrico Fucile *