diff --git a/CMakeLists.txt b/CMakeLists.txt index 43ffa725..b7803f43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ endif() # Set compiler flags. if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$") - set(CMAKE_Fortran_FLAGS "-g -traceback -convert big_endian -assume byterecl -fp-model strict -fpp -auto ${CMAKE_Fortran_FLAGS}") + set(CMAKE_Fortran_FLAGS "-g -traceback -assume byterecl -fp-model strict -fpp -auto ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check all -warn all") if(CMAKE_Fortran_COMPILER_ID MATCHES "^(IntelLLVM)$") # Avoid Intel OneAPI 2023.2.1 bug @@ -60,7 +60,7 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$") set(fortran_d_flags "-r8") set(fortran_8_flags "-i8 -r8") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") - set(CMAKE_Fortran_FLAGS "-g -fbacktrace -cpp -fconvert=big-endian ${CMAKE_Fortran_FLAGS}") + set(CMAKE_Fortran_FLAGS "-g -fbacktrace -cpp ${CMAKE_Fortran_FLAGS}") set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -Wall -Wno-unused-dummy-argument -Wsurprising -Wextra -fcheck=all") set(fortran_d_flags "-fdefault-real-8") set(fortran_8_flags "-fdefault-integer-8 -fdefault-real-8") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index fd623ef3..25040075 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,7 +10,11 @@ function(create_sp_test name kind timeout) target_link_libraries(${name}_${kind} PRIVATE OpenMP::OpenMP_Fortran) endif() target_link_libraries(${name}_${kind} PRIVATE ip::ip_${kind}) - set_target_properties(${name}_${kind} PROPERTIES COMPILE_FLAGS "${fortran_${kind}_flags}") + if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|IntelLLVM)$") + set_target_properties(${name}_${kind} PROPERTIES COMPILE_FLAGS "-convert big_endian ${fortran_${kind}_flags}") + elif(${CMAKE_Fortran_COMPILER_ID} MATCHES "^(GNU)$") + set_target_properties(${name}_${kind} PROPERTIES COMPILE_FLAGS "-fconvert=big-endian ${fortran_${kind}_flags}") + endif() add_test(NAME ${name}_${kind} COMMAND ${name}_${kind}) target_compile_definitions(${name}_${kind} PRIVATE KIND_${kind}) if(TEST_TIME_LIMIT)