diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f44bb8..566b38f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,21 +8,30 @@ 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") +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") - set(CMAKE_C_FLAGS_RELEASE "-O3") - set(CMAKE_Fortran_FLAGS "-ggdb -fno-range-check -fbacktrace -funroll-loops") +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() + set_source_files_properties(${c_src} PROPERTIES COMPILE_OPTIONS "${c_flags}") # One target for real32 and one target for real64