visual studio编译fortran
1、下载hpc-toolkithttps://www.intel.com/content/www/us/en/developer/tools/oneapi/hpc-toolkit-download.html
2、配置环境变量
检查ifx是否在环境变量中
3、
# FORTRAN code
enable_language(Fortran)
if(${CMAKE_Fortran_COMPILER} MATCHES "ifort.*")
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS} -fltconsistency")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -fltconsistency")
endif()
set(SRC
*.f
)
add_library(xxx STATIC
${SRC}
)
4、build
cmake -S . -B build -G “Visual Studio 16 2019” -T “fortran=ifx”