From 4e2555b293efb2b9cdf08b56d402cea6afcb026b Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Thu, 27 Aug 2020 13:49:50 -0400 Subject: [PATCH 1/2] GCC 10 flags, compiler check, and settable flags --- src/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f44bb8..e9a7966 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,21 +8,25 @@ elseif(UNIX) endif() if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") - set(CMAKE_C_FLAGS "-g") + set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-O3") - set(CMAKE_Fortran_FLAGS "-g") + set(CMAKE_Fortran_FLAGS "-g ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") set(fortran_d_flags "-r8") set(fortran_8_flags "-i8 -r8") elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - set(CMAKE_C_FLAGS "-ggdb") + set(CMAKE_C_FLAGS "-ggdb ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-O3") - set(CMAKE_Fortran_FLAGS "-ggdb -fno-range-check -fbacktrace -funroll-loops") + set(CMAKE_Fortran_FLAGS "-ggdb -fno-range-check -fbacktrace -funroll-loops ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") set(fortran_d_flags "-fdefault-real-8") set(fortran_8_flags "-fdefault-integer-8 -fdefault-real-8") endif() +if(${CMAKE_Fortran_COMPILER_ID} MATCHES "^(GNU)$" AND ${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w -fallow-argument-mismatch -fallow-invalid-boz") +endif() + set_source_files_properties(${c_src} PROPERTIES COMPILE_OPTIONS "${c_flags}") # One target for real32 and one target for real64 From a20b4d09189ec0548e8ec2b7b07917c46fdcb58a Mon Sep 17 00:00:00 2001 From: kgerheiser Date: Thu, 27 Aug 2020 14:14:46 -0400 Subject: [PATCH 2/2] Separate out Fortran compiler check --- src/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e9a7966..566b38f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,19 +10,24 @@ endif() if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_C_FLAGS "-g ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "-O3") +elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_C_FLAGS "-ggdb ${CMAKE_C_FLAGS}") + set(CMAKE_C_FLAGS_RELEASE "-O3") +endif() + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "-g ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") set(fortran_d_flags "-r8") set(fortran_8_flags "-i8 -r8") -elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - set(CMAKE_C_FLAGS "-ggdb ${CMAKE_C_FLAGS}") - set(CMAKE_C_FLAGS_RELEASE "-O3") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "-ggdb -fno-range-check -fbacktrace -funroll-loops ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") set(fortran_d_flags "-fdefault-real-8") set(fortran_8_flags "-fdefault-integer-8 -fdefault-real-8") endif() + if(${CMAKE_Fortran_COMPILER_ID} MATCHES "^(GNU)$" AND ${CMAKE_Fortran_COMPILER_VERSION} VERSION_GREATER_EQUAL 10) set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -w -fallow-argument-mismatch -fallow-invalid-boz") endif()