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 
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)
    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:


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


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

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)

   (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:

Tagscross compile
Attached Files


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.
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