View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013896CMakeCMakepublic2013-02-07 12:332013-07-01 09:35
ReporterLeszek Swirski 
Assigned ToBrad King 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMSVCOSWindowsOS Version7
Product VersionCMake 2.8.10.2 
Target VersionCMake 2.8.11Fixed in VersionCMake 2.8.11 
Summary0013896: CMAKE_CL_64 incorrectly set for CXX projects
DescriptionCMAKE_CL_64 only checks the value of MSVC_C_ARCHITECTURE_ID, not MSVC_CXX_ARCHITECTURE_ID.

This means that CXX only projects [projects defined as project(x CXX)] and CXX-first projects [projects defined as project(x CXX C) rather than project(x C CXX)] do not correctly set CMAKE_CL_64 = 1 when MSVC_CXX_ARCHITECTURE_ID = x64
Steps To ReproduceUsing a Visual Studio x64 command shell, running cmake on:

    -- CMakeLists.txt
    project(test CXX)
    message("MSVC_CXX_ARCHITECTURE_ID = ${MSVC_CXX_ARCHITECTURE_ID}")
    message("CMAKE_CL_64 = ${CMAKE_CL_64}")

prints:

    MSVC_CXX_ARCHITECTURE_ID = x64
    CMAKE_CL_64 = 0

and

    -- CMakeLists.txt
    project(test CXX C)
    message("MSVC_C_ARCHITECTURE_ID = ${MSVC_C_ARCHITECTURE_ID}")
    message("MSVC_CXX_ARCHITECTURE_ID = ${MSVC_CXX_ARCHITECTURE_ID}")
    message("CMAKE_CL_64 = ${CMAKE_CL_64}")

prints:

    MSVC_C_ARCHITECTURE_ID = x64
    MSVC_CXX_ARCHITECTURE_ID = x64
    CMAKE_CL_64 = 0

while the following

    -- CMakeLists.txt
    project(test C CXX)
    message("MSVC_C_ARCHITECTURE_ID = ${MSVC_C_ARCHITECTURE_ID}")
    message("MSVC_CXX_ARCHITECTURE_ID = ${MSVC_CXX_ARCHITECTURE_ID}")
    message("CMAKE_CL_64 = ${CMAKE_CL_64}")

prints:

    MSVC_C_ARCHITECTURE_ID = x64
    MSVC_CXX_ARCHITECTURE_ID = x64
    CMAKE_CL_64 = 1
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0032211)
Brad King (manager)
2013-02-07 14:53

Try this patch:

diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 3a38d8f..f9df6d8 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -107,7 +107,7 @@ if(NOT MSVC_VERSION)
   endif()
 endif()
 
-if(MSVC_C_ARCHITECTURE_ID MATCHES 64)
+if(MSVC_C_ARCHITECTURE_ID MATCHES 64 OR MSVC_CXX_ARCHITECTURE_ID MATCHES 64)
   set(CMAKE_CL_64 1)
 else()
   set(CMAKE_CL_64 0)
(0032212)
Leszek Swirski (reporter)
2013-02-07 14:54

That's exactly the fix I actually applied on my machine, and it works.
(0032214)
Brad King (manager)
2013-02-07 15:06

Applied, thanks:

 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fe664b5d [^]
(0033414)
Robert Maynard (manager)
2013-07-01 09:35

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-02-07 12:33 Leszek Swirski New Issue
2013-02-07 14:53 Brad King Note Added: 0032211
2013-02-07 14:54 Leszek Swirski Note Added: 0032212
2013-02-07 15:06 Brad King Note Added: 0032214
2013-02-07 15:06 Brad King Assigned To => Brad King
2013-02-07 15:06 Brad King Status new => resolved
2013-02-07 15:06 Brad King Resolution open => fixed
2013-02-07 15:06 Brad King Fixed in Version => CMake 2.8.11
2013-02-07 15:06 Brad King Target Version => CMake 2.8.11
2013-07-01 09:35 Robert Maynard Note Added: 0033414
2013-07-01 09:35 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team