View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015173 | CMake | CMake | public | 2014-09-27 15:25 | 2016-05-02 08:30 | ||||
Reporter | Christoph Bastuck | ||||||||
Assigned To | |||||||||
Priority | none | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | unable to reproduce | ||||||
Platform | x86_64 | OS | Windows | OS Version | 8.1 | ||||
Product Version | CMake 3.0.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015173: MinGW compiler can NOT be used when also Visual Studio 2013 is installed | ||||||||
Description | Using Cmake 3.0.2 and compiling my project with MinGW with following command for Makefile generation: cmake X:\Projects\Path -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_RC_COMPILER=windres -G "MinGW Makefiles" gcc/g++ is in PATH and cl/link is NOT. CMake is actually detecting g++/gcc compiler and tries to compile a test sample. But uses visual studio style compiler flags instead of gcc style, i.e. /DWIN32 instead of -DWIN32. Hence compiling fails. Currently there seems possibility to choose MinGW (explicitly). So downgraded to Cmake 2.8. Here selecting the generator with flag "-G" work as expected. | ||||||||
Steps To Reproduce | 1. Install MinGW compiler and Visual Studio 2013 on same machine 2. PATH must hold to MingGW compiler 3. remove cl/link from PATH if exists 4. Create MinGW Makefile for your project wirh command: cmake X:\Projects\Path -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_RC_COMPILER=windres -G "MinGW Makefiles" | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0036868) Brad King (manager) 2014-09-29 08:52 |
I cannot reproduce this. I have VS 2013 installed. With: PATH=C:\Windows\system32;C:\Windows;c:\MinGW\bin and cmake 3.0.2 the command cmake c:\path\to\project\src -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_RC_COMPILER=windres -G "MinGW Makefiles" works as expected. |
(0039475) Dan Conway (reporter) 2015-09-23 16:08 |
Delete your CMakeCache and try again. It is likely you ran cmake once without setting -G the first time, and it configured it with flags for msvc. This is also why others are not able to reproduce. ;D |
(0039478) Johannes S. Mueller-Roemer (reporter) 2015-09-25 08:52 |
I can't reproduce either. Neither on Windows 7, 8, nor 10. |
(0039550) Dan Conway (reporter) 2015-10-08 14:03 edited on: 2015-10-08 14:04 |
I can reproduce the issue, as well as the solution. To reproduce the issue, I run it first without -G "MinGW Makefiles", then with -G "MinGW Makefiles": then the issue occurs. The solution is to delete your CMakeCache then run with -G "MinGW Makefiles". Please update if you have tried deleting CMakeCache then running. If you run it without The MinGW Makefiles, it configures the cache to be using the visual studio / style flags. If you then run it with the mingw makefiles, it will still be trying to use the visual studio style flags unless you delete the Cache first. An alternative solution would be to manually edit CMakeCache, and change the flags yourself -- but this would be the improper way to go about it, and other settings in the cache might be setup for visual studio instead of mingw and need adjustment. |
(0039554) Johannes S. Mueller-Roemer (reporter) 2015-10-09 02:42 |
Again, can't reproduce. If I first configure without a specified generator, it is configured for the newest VS compiler in 32 bit mode. If I then specify a generator I get the (expected!) error: CMake Error: Error: generator : MinGW Makefiles Does not match the generator used previously: Visual Studio 12 2013 Either remove the CMakeCache.txt file and CMakeFiles directory or choose a different binary director y. This happens even if I have nothing but cmake and mingw on my path. |
(0039556) Christoph Bastuck (reporter) 2015-10-09 06:58 |
Sorry for replying so late on this. It sounds plausible that CMakeCache is causing the problem. Although I was very sure that this was NOT the root cause when filing the bug in the first place I am not 100% sure anymore. I will try to recover my old setup and report the findings here. |
(0039716) Christoph Bastuck (reporter) 2015-11-01 14:00 |
Indeed was a problem in the environment I was using to create the Makefiles. |
(0040952) Robert Maynard (manager) 2016-05-02 08:30 |
Closing resolved issues that have not been updated in more than 4 months. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-09-27 15:25 | Christoph Bastuck | New Issue | |
2014-09-29 08:52 | Brad King | Note Added: 0036868 | |
2015-09-23 16:08 | Dan Conway | Note Added: 0039475 | |
2015-09-25 08:52 | Johannes S. Mueller-Roemer | Note Added: 0039478 | |
2015-09-25 08:57 | Brad King | Status | new => resolved |
2015-09-25 08:57 | Brad King | Resolution | open => unable to reproduce |
2015-10-08 14:03 | Dan Conway | Note Added: 0039550 | |
2015-10-08 14:04 | Dan Conway | Note Edited: 0039550 | |
2015-10-08 14:04 | Dan Conway | Note Edited: 0039550 | |
2015-10-08 14:04 | Dan Conway | Note Edited: 0039550 | |
2015-10-09 02:42 | Johannes S. Mueller-Roemer | Note Added: 0039554 | |
2015-10-09 06:58 | Christoph Bastuck | Note Added: 0039556 | |
2015-11-01 14:00 | Christoph Bastuck | Note Added: 0039716 | |
2016-05-02 08:30 | Robert Maynard | Note Added: 0040952 | |
2016-05-02 08:30 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |