summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-16 14:33:06 (GMT)
committerBrad King <brad.king@kitware.com>2010-12-16 14:33:06 (GMT)
commit58c73c43f62d581f62d694f5d144a021b9832284 (patch)
treefb7eec1e6a831116437668944bb9c4c92a5f904d /Modules
parent3fb088e521584dfed27513faf556b8b0d6cc73d3 (diff)
downloadCMake-58c73c43f62d581f62d694f5d144a021b9832284.zip
CMake-58c73c43f62d581f62d694f5d144a021b9832284.tar.gz
CMake-58c73c43f62d581f62d694f5d144a021b9832284.tar.bz2
Detect Fortran target architecture on Windows
Commit 4430bccc (Change the way 32/64 bit compiles are detected with MSVC and intel, 2009-11-19) added detection of the target processor to C and CXX language builds with MS and Intel tools. Do the same for Intel Fortran for Windows (ifort). Use /machine:<arch> to link executables.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake4
-rw-r--r--Modules/CMakeFortranCompiler.cmake.in1
-rw-r--r--Modules/CMakeFortranCompilerId.F.in9
-rw-r--r--Modules/Platform/Windows-ifort.cmake5
4 files changed, 18 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 03ddd78..ebab8bc 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -215,6 +215,10 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN)
INCLUDE(CMakeFindBinUtils)
+IF(MSVC_Fortran_ARCHITECTURE_ID)
+ SET(SET_MSVC_Fortran_ARCHITECTURE_ID
+ "SET(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})")
+ENDIF()
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake
diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in
index 5558651..146a6f2 100644
--- a/Modules/CMakeFortranCompiler.cmake.in
+++ b/Modules/CMakeFortranCompiler.cmake.in
@@ -2,6 +2,7 @@ SET(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@")
SET(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@")
SET(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@")
SET(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@")
+@SET_MSVC_Fortran_ARCHITECTURE_ID@
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@)
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 4080cc1..8584731 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -109,4 +109,13 @@
# endif
PRINT *, 'INFO:platform[]'
#endif
+#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC))
+# if defined(_M_IA64)
+ PRINT *, 'INFO:arch[IA64]'
+# elif defined(_M_X64) || defined(_M_AMD64)
+ PRINT *, 'INFO:arch[x64]'
+# elif defined(_M_IX86)
+ PRINT *, 'INFO:arch[X86]'
+# endif
+#endif
END
diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake
index 6cffed9..1fd734e 100644
--- a/Modules/Platform/Windows-ifort.cmake
+++ b/Modules/Platform/Windows-ifort.cmake
@@ -63,7 +63,10 @@ SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")
# executable linker flags
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
-SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES")
+IF(NOT _MACHINE_ARCH_FLAG)
+ SET(_MACHINE_ARCH_FLAG ${MSVC_Fortran_ARCHITECTURE_ID})
+ENDIF(NOT _MACHINE_ARCH_FLAG)
+SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}")
IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept")
SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept")