Skip to content

Commit

Permalink
cmake: compiler feature checks before flags
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Apr 19, 2020
1 parent 1df6f9d commit fe19f9f
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions cmake/compilers.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo;Debug" CACHE STRING "Build type selections" FORCE)


include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckFortranSourceCompiles)

include(${CMAKE_CURRENT_LIST_DIR}/f08block.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f08contig.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18errorstop.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18random.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18assumed_rank.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f08kind.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18prop.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f08command.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f03ieee.cmake)

# compiler feature checks BEFORE setting flags to avoid intermittant failures in general

if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel)
if(WIN32)
add_compile_options(/arch:native)
Expand Down Expand Up @@ -29,17 +46,3 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL NAG)
# https://www.nag.co.uk/nagware/np/r70_doc/manual/compiler_2_4.html#OPTIONS
string(APPEND CMAKE_Fortran_FLAGS " -f2018 -C -colour -gline -nan -info -u")
endif()

include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckFortranSourceCompiles)

include(${CMAKE_CURRENT_LIST_DIR}/f08block.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f08contig.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18errorstop.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18random.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18assumed_rank.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f08kind.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f18prop.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f08command.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/f03ieee.cmake)

0 comments on commit fe19f9f

Please sign in to comment.