Bug #54540 CMAKE_INSTALL_PREFIX always contains Program Files (x86)
Submitted: 16 Jun 2010 4:39 Modified: 16 Jun 2010 7:36
Reporter: Georg Richter Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:all OS:Microsoft Windows (64bit)
Assigned to: CPU Architecture:Any
Triage: Triaged: D3 (Medium)

[16 Jun 2010 4:39] Georg Richter
Description:
When building with cmake CMAKE_INSTALL_PREFIX always contains the path ProgramFiles (x86), even on a 64-bit System.

How to repeat:
Add MESSAGE(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
to your CMakeLists.txt and execute

cmake -G "Visual Studio 8 2005 Win64"

Suggested fix:
IF(WIN32)
    IF (CMAKE_SIZEOF_VOID_P MATCHES 8)
      #64-bit build
      FILE(TO_CMAKE_PATH "$ENV{ProgramW6432}/MySQL/MySQL Connector C" CMAKE_INSTALL_PREFIX)
    ELSE (CMAKE_SIZEOF_VOID_P MATCHES 8)
      IF($ENV{ProgramW6432})
        #32 bit build on 64-bit platform
        FILE(TO_CMAKE_PATH "$ENV{ProgramFiles (x86)}/MySQL/MySQL Connector C" CMAKE_INSTALL_PREFIX)
      ELSE($ENV{ProgramW6432})
        #32 bit build on 32-bit platform
        FILE(TO_CMAKE_PATH "$ENV{ProgramFiles}/MySQL/MySQL Connector C" CMAKE_INSTALL_PREFIX)
      ENDIF($ENV{ProgramW6432})
    ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
ENDIF(WIN32)