Package Details: mingw-w64-cmake 1-14

Git Clone URL: (read-only)
Package Base: mingw-w64-cmake
Description: CMake wrapper for MinGW (mingw-w64)
Upstream URL:
Licenses: GPL
Submitter: brcha
Maintainer: xantares
Last Packager: xantares
Votes: 30
Popularity: 2.164012
First Submitted: 2013-04-17 12:11
Last Updated: 2016-09-03 19:48

Required by (88)

Sources (3)

  • toolchain-mingw.cmake

Latest Comments

markand commented on 2016-09-12 20:19

Oh I didn't know strip could remove the debug symbols, I always thought it was for removing useless ones.

I will double check if it produces the same executable once stripped, thanks.

Martchus commented on 2016-09-11 16:52

I think xantares' explanation makes sense:
"-g -O2" makes great sense actually: when you're debugging you want your code to behave like the the release code in order to better reproduce bugs. Debug symbols are actually removed by the strip commands ... .

markand commented on 2016-09-11 14:39

Can you also remove the -g flag from the CFLAGS in the CMake script? I wonder why is it enabled globally as it's only relevant in Debug builds. Thanks.

Martchus commented on 2016-09-03 16:02

markand: I noticed the same problem with some of my own projects (qtutilities) and wasn't able to fix it yet. The problem occurred with a mingw-w64-gcc update, but actually it is CMake which messes the include paths. It is still unclear to me why this happens but I'll try your fix. If it works, I would also vote for including it here.

markand commented on 2016-09-03 15:37

After some investigation and tests with ngladitz from the #cmake channel, I figured out how to fix. We need to set CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES to make it work.

Would you mind adding this to the x86_64-w64-mingw32-cmake (and same for 32 bits)


markand commented on 2016-09-02 05:11

I don't know if it's a CMake problem, but once I try to build a program that links to mingw-w64-openssl library, the include headers are broken.

This is a test project:

cmake_minimum_required(VERSION 3.5)
find_package(OpenSSL REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main OpenSSL::SSL OpenSSL::Crypto)

Compiling like this:

x86_64-w64-mingw32-cmake .

Ends with that error:

In file included from /tmp/test/main.cpp:1:0:
/usr/x86_64-w64-mingw32/include/c++/6.1.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>

However, removing the last target_link_libraries builds successfully. The includes specified by cmake are defined as: -isystem /usr/x86_64-w64-mingw32/include

I could not find anything in the FindOpenSSL.cmake that use this directory.

EDIT: after some investigation, it seems that any libraries linked to the project break it. I can reproduce the same problem with FindPNG package and mingw-w64-libpng.

xantares commented on 2016-07-13 20:05

You can override the -02 flag by appending -O0, ie "-O2 -O0" are valid CFLAGS, the last (-O0) value overrides the level 2 optimization O2.

Martchus commented on 2016-07-13 19:59

Of course I know that debug symbols are stripped anyways. I was just wondering about the combination with -O2 but your explanation makes sense.

I just mentioned -g because I've read the previous discussion. Actually I want to get rid of -O2 as a workaround for the mentioned issue (see my first comment). Hence overwriting (and not just appending) would still be useful for me. Maybe there are other use cases, too. If you like, you can try to reproduce the issue (should only take 1 minute).

xantares commented on 2016-07-13 19:40

"-g -O2" makes great sense actually: when you're debugging you want your code to behave like the the release code in order to better reproduce bugs.
Debug symbols are actually removed by the strip commands so if you wanted to override flags just to disable -g it's useless.

Martchus commented on 2016-07-13 18:32

Thanks for your fast response :-)

I know appending is possible in mingw-w64-configure. If you look at the code in my repo you'll see I also added this for mingw-w64-cmake. However, it would be nice to get completely rid of some flags. That is why I'd like to introduce another environment variable for that. I think this wouldn't hurt anyone.

BTW: I also read the previous discussion about the default flags and I have to say that these are a bit strange indeed. In particular the combination of -g (which generated debugger information) and -O2 (which enables most of the available optimizations) doesn't make very much sense to me.

EDIT: kalev from #fedora-mingw just told me that the reason they chose those particular build flags is to match the build flags regular Fedora binaries use as similar as possible.

All comments