summaryrefslogtreecommitdiff
path: root/Modules/Platform/Windows-cl.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Platform/Windows-cl.cmake')
-rw-r--r--Modules/Platform/Windows-cl.cmake41
1 files changed, 11 insertions, 30 deletions
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index 303ef34722..e369ac1599 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -141,32 +141,14 @@ IF(CMAKE_GENERATOR MATCHES "Makefiles")
SET(CMAKE_USING_VC_FREE_TOOLS 0)
ENDIF(CMAKE_COMPILER_RETURN)
MAKE_DIRECTORY("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3")
- MESSAGE(STATUS "Check CL platform")
- EXEC_PROGRAM(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3
- ARGS /nologo
- \"${testForFreeVCFile}\"
- /link /machine:i386
- OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT
- RETURN_VALUE CMAKE_COMPILER_RETURN
- )
- # if there was an error assume it is a 64bit system
- IF(CMAKE_COMPILER_RETURN)
- FILE(APPEND
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Determining if this is a 64 bit system passed:\n"
- "${CMAKE_COMPILER_OUTPUT}\n\n")
- MESSAGE(STATUS "Check CL platform - 64 bit")
- SET(CMAKE_CL_64 1)
- ELSE(CMAKE_COMPILER_RETURN)
- FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Determining if this is a 32 bit system passed:\n"
- "${CMAKE_COMPILER_OUTPUT}\n\n")
- MESSAGE(STATUS "Check CL platform - 32 bit")
- SET(CMAKE_CL_64 0)
- ENDIF(CMAKE_COMPILER_RETURN)
ENDIF(NOT CMAKE_VC_COMPILER_TESTS_RUN)
ENDIF(CMAKE_GENERATOR MATCHES "Makefiles")
+IF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+ SET(CMAKE_CL_64 1)
+ELSE(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+ SET(CMAKE_CL_64 0)
+ENDIF(MSVC_C_ARCHITECTURE_ID MATCHES 64)
IF(CMAKE_FORCE_WIN64)
SET(CMAKE_CL_64 1)
ENDIF(CMAKE_FORCE_WIN64)
@@ -235,13 +217,12 @@ SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
# executable linker flags
SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
# set the stack size and the machine type
-IF(CMAKE_CL_64)
- SET (CMAKE_EXE_LINKER_FLAGS_INIT
- "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:x64")
-ELSE(CMAKE_CL_64)
- SET (CMAKE_EXE_LINKER_FLAGS_INIT
- "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:I386")
-ENDIF(CMAKE_CL_64)
+SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
+IF(NOT _MACHINE_ARCH_FLAG)
+ SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
+ENDIF(NOT _MACHINE_ARCH_FLAG)
+SET (CMAKE_EXE_LINKER_FLAGS_INIT
+ "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
# add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtyp
# on versions that support it