@@ -32,19 +32,25 @@ include(CheckFortranCompilerFlag)
3232
3333# === Check Compiler Support & Tools
3434# === === Compiler Support
35+ set (__err_msg "\
36+ CMake detected the ${CMAKE_Fortran_COMPILER_ID} Fortran compiler \
37+ v${CMAKE_Fortran_COMPILER_VERSION} . If you intended to use a different \
38+ compiler (or a different version thereof), please:\n\
39+ - Install the compiler or load its module. (e.g. module load gcc/10.1)\n\
40+ - Set/Export the C, CXX, and FC environment variables. (e.g. 'export CC=gcc', \
41+ 'export CXX=g++', and 'export FC=gfortran'.\n\
42+ - If using mfc.sh, delete the build/<code name> directory and try again. (e.g. 'rm -rf build/pre_process')\n " )
43+
3544if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" )
3645 if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)
37- message (FATAL_ERROR "GNU v5.0 or newer is required to build MFC. "
38- "[current: ${CMAKE_Fortran_COMPILER_VERSION} ]" )
46+ message (FATAL_ERROR "${__err_msg} ERROR: GNU v5.0 or newer is required to build MFC." )
3947 endif ()
4048elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" ) OR (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" ))
4149 if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7)
42- message (FATAL_ERROR "NVHPC v21.7 or newer is required to build MFC. "
43- "[current: ${CMAKE_Fortran_COMPILER_VERSION} ]" )
50+ message (FATAL_ERROR "${__err_msg} ERROR: NVHPC v21.7 or newer is required to build MFC." )
4451 endif ()
45- elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" )
46- message (FATAL_ERROR "MFC does not support the Apple Clang compilers. "
47- "Please consult the README for more details." )
52+ elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang" )
53+ message (FATAL_ERROR "${__err_msg} ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation." )
4854endif ()
4955
5056# === === Find Fypp
0 commit comments