summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler
diff options
context:
space:
mode:
authorTin Huynh <ahuynh@nvidia.com>2017-08-05 00:50:09 (GMT)
committerBrad King <brad.king@kitware.com>2017-08-31 19:24:59 (GMT)
commit2f3a07a981edfbc325f19ea252003e9da59dbcf5 (patch)
tree6ca31c90c90ddec49fde7009262775dc16078cfa /Modules/Compiler
parent9bad65940c87f594a5f1007019d4b187068dbce0 (diff)
downloadCMake-2f3a07a981edfbc325f19ea252003e9da59dbcf5.zip
CMake-2f3a07a981edfbc325f19ea252003e9da59dbcf5.tar.gz
CMake-2f3a07a981edfbc325f19ea252003e9da59dbcf5.tar.bz2
Flang: Add support for flang Fortran compiler
flang is a Fortran compiler built on top of clang [1]. Because flang shares a lot of commonalities with clang, the flang module piggybacks off the clang module and overrides certain options. Add flang to Fortran compiler auto find list. Update flang preprocessor macros to differentiate from PGI. Add Flang-FindBinUtils. [1] https://github.com/flang-compiler/flang
Diffstat (limited to 'Modules/Compiler')
-rw-r--r--Modules/Compiler/Flang-FindBinUtils.cmake1
-rw-r--r--Modules/Compiler/Flang-Fortran.cmake12
2 files changed, 13 insertions, 0 deletions
diff --git a/Modules/Compiler/Flang-FindBinUtils.cmake b/Modules/Compiler/Flang-FindBinUtils.cmake
new file mode 100644
index 0000000..e721c87
--- /dev/null
+++ b/Modules/Compiler/Flang-FindBinUtils.cmake
@@ -0,0 +1 @@
+include(Compiler/Clang-FindBinUtils)
diff --git a/Modules/Compiler/Flang-Fortran.cmake b/Modules/Compiler/Flang-Fortran.cmake
new file mode 100644
index 0000000..f17dec7
--- /dev/null
+++ b/Modules/Compiler/Flang-Fortran.cmake
@@ -0,0 +1,12 @@
+include(Compiler/Clang)
+__compiler_clang(Fortran)
+
+set(CMAKE_Fortran_PREPROCESS_SOURCE
+ "<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>")
+
+set(CMAKE_Fortran_FORMAT_FIXED_FLAG "-ffixed-form")
+set(CMAKE_Fortran_FORMAT_FREE_FLAG "-ffree-form")
+
+string(APPEND CMAKE_Fortran_FLAGS_DEBUG_INIT " -fbounds-check")
+
+set(CMAKE_Fortran_MODDIR_FLAG "-J")