diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-11-20 02:58:42 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-11-20 02:58:42 (GMT) |
commit | 4430bccc700cd8b12164f9d1b5658a14e62dd0d5 (patch) | |
tree | 8eba965c471e5620fb2957d4fcc340235b503034 /Modules/Platform/Windows-cl.cmake | |
parent | 1699836b0632b5a16ceac7cfdcc76e0d753e0880 (diff) | |
download | CMake-4430bccc700cd8b12164f9d1b5658a14e62dd0d5.zip CMake-4430bccc700cd8b12164f9d1b5658a14e62dd0d5.tar.gz CMake-4430bccc700cd8b12164f9d1b5658a14e62dd0d5.tar.bz2 |
Change the way 32/64 bit compiles are detected with MSVC and intel makefile builds. Use the platform ID preprocessor approach.
Diffstat (limited to 'Modules/Platform/Windows-cl.cmake')
-rw-r--r-- | Modules/Platform/Windows-cl.cmake | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 303ef34..e369ac1 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 |