[cmake-developers] [CMake 0014827]: Preprocessor definitions for x64 projects are not correct on Windows Platform.

J Decker d3ck0r at gmail.com
Mon Mar 24 08:06:27 EDT 2014


Personally I liked that win32 was defined still, since that caused the
least disruption to existing code.  I have additional tests to enable 64bit
by testing for cmake_cl_64 then more generically with CMAKE_SIZEOF_VOID_P

since the API doesn't really change, it still really looks like a win32
system.


On Mon, Mar 24, 2014 at 4:13 AM, Mantis Bug Tracker <
mantis at public.kitware.com> wrote:

>
> The following issue has been SUBMITTED.
> ======================================================================
> http://public.kitware.com/Bug/view.php?id=14827
> ======================================================================
> Reported By:                Vikas Pachisia
> Assigned To:
> ======================================================================
> Project:                    CMake
> Issue ID:                   14827
> Category:                   Development
> Reproducibility:            always
> Severity:                   major
> Priority:                   high
> Status:                     new
> ======================================================================
> Date Submitted:             2014-03-24 07:13 EDT
> Last Modified:              2014-03-24 07:13 EDT
> ======================================================================
> Summary:                    Preprocessor definitions for x64 projects are
> not
> correct on Windows Platform.
> Description:
> When trying to make a x64 windows project using CMake it always assigns the
> platform defines as WIN32 while it should be assigning the platform define
> as
> WIN64.
>
> Steps to Reproduce:
> 1. Try to make a simple basic x64 project that will create a visual studio
> solution file (.sln) file.
> 2. Open the solution file that contains the x64 project.
> 3. Check the Project Properties for C++ -> Preprocessor -> Preprocessor
> Definitions
> 4. You can see WIN32 as the preprocessor defines where as it should be
> WIN64.
>
> Additional Information:
> The following change can fix this for most projects:
>
> 1. Open the CMake file:
>     C:\Program Files (x86)\CMake
> 2.8\share\cmake-2.8\Modules\Platform\Windows-MSVC.cmake
>
> 2. Search for the code:
> 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)
> endif()
> if(CMAKE_FORCE_WIN64 OR CMAKE_FORCE_IA64)
>   set(CMAKE_CL_64 1)
> endif()
>
> 3. Add the following new code after the end if mentioned above:
> if(CMAKE_CL_64)
>         set(WIN64 1)
> else()
>         set(WIN32 1)
> endif()
>
> 4. Search for 'set(_PLATFORM_DEFINES "/DWIN32")'
> 5. Replace the above line with the following code:
>         if(CMAKE_CL_64)
>                 set(_PLATFORM_DEFINES "/DWIN64")
>         else()
>                 set(_PLATFORM_DEFINES "/DWIN32")
>         endif()
> ======================================================================
>
> Issue History
> Date Modified    Username       Field                    Change
> ======================================================================
> 2014-03-24 07:13 Vikas Pachisia New Issue
> 2014-03-24 07:13 Vikas Pachisia File Added: Windows-MSVC.cmake
>
> ======================================================================
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140324/d44c5c8b/attachment-0002.html>


More information about the cmake-developers mailing list