View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013929CMakeCPackpublic2013-02-17 17:252016-06-10 14:31
ReporterNathan Osman 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformLinuxOSUbuntuOS Version12.10
Product VersionCMake 2.8.10 
Target VersionFixed in Version 
Summary0013929: __cpack_system_name incorrectly set when compiling with Mingw-w64
DescriptionI have a CMake/CPack project that I am cross-compiling for 32 and 64-bit Windows. CPack generates an NSIS installer for both architectures but incorrectly detects a 32-bit compiler in both cases.

After looking through the source code for Modules/CPack.cmake, I came across the following:

if(${__cpack_system_name} MATCHES Windows)
  if(CMAKE_CL_64)
    set(__cpack_system_name win64)
...

It appears that CPack is only checking for the 64-bit compiler that ships with MSVC++ and not for Mingw-w64.
Steps To ReproduceAssuming you have the Mingw-w64 compiler installed, the following steps will reproduce the problem:

1. Create a very simple project that consists of the following files:

   test.cpp:

       #include <iostream>
       
       int main(int argc, char ** argv)
       {
           std::cout << "Hello world!" << std::endl;
           return 0;
       }

   CMakeLists.txt:

       cmake_minimum_required(VERSION 2.8)
       
       project(test)
       add_executable(test test.cpp)
       install(TARGETS test RUNTIME DESTINATION bin)
       
       include(CPack)

2. Create a CMake toolchain file like so (toolchain.cmake in the same directory):

       set(CMAKE_SYSTEM_NAME Windows)
       
       set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
       set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
       set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
       
       set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
       
       set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
       set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
       set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

   (You may need to adjust the value of "CMAKE_FIND_ROOT_PATH".)

3. Build the package:

       mkdir build ; cd build
       cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake ..
       make package

4. You should end up with an incorrectly named installer titled:

       test-0.1.1-win32.exe
Tagscross compile
Attached Files

 Relationships

  Notes
(0032320)
Nathan Osman (reporter)
2013-02-17 17:27

Oh, I almost forgot - you will also need the NSIS command line compiler installed to perform the steps above to reproduce the problem.
(0042226)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2013-02-17 17:25 Nathan Osman New Issue
2013-02-17 17:26 Nathan Osman Tag Attached: cross compile
2013-02-17 17:27 Nathan Osman Note Added: 0032320
2016-06-10 14:28 Kitware Robot Note Added: 0042226
2016-06-10 14:28 Kitware Robot Status new => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team