11cmake_minimum_required (VERSION 3.14.0)
2+
3+ # Include overwrites before setting up the project
4+ set (CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR} /config/DefaultFlags.cmake)
5+
26project (fortran_stdlib
37 LANGUAGES Fortran
48 DESCRIPTION "Community driven and agreed upon de facto standard library for Fortran"
@@ -22,31 +26,9 @@ include(${PROJECT_SOURCE_DIR}/cmake/stdlib.cmake)
2226# --- CMake specific configuration and package data export
2327add_subdirectory (config)
2428
25- # --- compiler options
26- if (CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
27- if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0)
28- message (FATAL_ERROR "GCC Version 9 or newer required" )
29- endif ()
30- add_compile_options (-fimplicit-none)
31- add_compile_options (-ffree-line-length -132)
32- add_compile_options (-fno-range-check) # Needed for gfortran 9 and
33- # earlier for hash functions
34- add_compile_options (-Wall)
35- add_compile_options (-Wextra)
36- add_compile_options (-Wimplicit-procedure)
37- # -pedantic-errors triggers a false positive for optional arguments of elemental functions,
38- # see test_optval and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446
39- if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 11.0)
40- add_compile_options (-pedantic-errors)
41- endif ()
42- add_compile_options (-std=f2018)
43- elseif (CMAKE_Fortran_COMPILER_ID MATCHES "^Intel" )
44- if (WIN32 )
45- set (fortran_flags /stand:f18 /warn:declarations,general,usage,interfaces,unused)
46- else ()
47- set (fortran_flags -stand f18 -warn declarations,general,usage,interfaces,unused)
48- endif ()
49- add_compile_options ("$<$<COMPILE_LANGUAGE:Fortran>:${fortran_flags} >" )
29+ # --- compiler selection
30+ if (CMAKE_Fortran_COMPILER_ID STREQUAL GNU AND CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 9.0)
31+ message (FATAL_ERROR "GCC Version 9 or newer required" )
5032endif ()
5133
5234# --- compiler feature checks
0 commit comments