summaryrefslogtreecommitdiff
path: root/Modules/CMakeFortranInformation.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-01-31 16:24:12 -0500
committerBrad King <brad.king@kitware.com>2011-01-31 16:24:12 -0500
commit93f230e408cba124dc5ba97b1ef7f228ccb4fcc9 (patch)
treecd662ea94a52e65dff319a3233bec45db5b9cd0f /Modules/CMakeFortranInformation.cmake
parent63d21c1f8efeb2f2337221119c479d75bbb0b7c0 (diff)
downloadcmake-93f230e408cba124dc5ba97b1ef7f228ccb4fcc9.tar.gz
Pass -o after -c for Fortran to avoid mpif77 ordering bug
When running $ mpif77 -c example.f -o example.f.o mpif77 recognizes -o and produces example.f.o, but when running $ mpif77 -o example.f.o -c example.f the -o option is ignored and the object file is example.o. Performing the same experiment on the underlying compiler tool or with the mpicc and mpiCC wrappers does not exhibit this behavior, so the issue appears to be specific to mpif77. Reported-by: Zhen Wang <zwang26@emory.edu>
Diffstat (limited to 'Modules/CMakeFortranInformation.cmake')
-rw-r--r--Modules/CMakeFortranInformation.cmake3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index f6a52c6eb2..80f5e463ad 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -168,9 +168,10 @@ SET(CMAKE_Fortran_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>"
SET(CMAKE_Fortran_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
# compile a Fortran file into an object file
+# (put -o after -c to workaround bug in at least one mpif77 wrapper)
IF(NOT CMAKE_Fortran_COMPILE_OBJECT)
SET(CMAKE_Fortran_COMPILE_OBJECT
- "<CMAKE_Fortran_COMPILER> -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>")
+ "<CMAKE_Fortran_COMPILER> <DEFINES> <FLAGS> -c <SOURCE> -o <OBJECT>")
ENDIF(NOT CMAKE_Fortran_COMPILE_OBJECT)
# link a fortran program