← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Enable C++11

 

Le 17/03/2016 10:23, Nick Østergaard a écrit :
> 2016-03-17 10:15 GMT+01:00 jp charras <jp.charras@xxxxxxxxxx>:
>> Le 10/03/2016 08:30, Simon Richter a écrit :
>>>
>>> This enables C++11 support, if either CMake is sufficiently new to have
>>> this feature built in, or the compiler is supported by the workaround code
>>> (gcc or clang).
>>> ---
>>>  CMakeLists.txt | 23 +++++++++++++++++++++++
>>>  1 file changed, 23 insertions(+)
>>
>> After a few tests:
>>
>> I can compile Kicad on W7 32 bits + msys2 and Kubuntu 14.04 LTS with option
>> -std=gnu++11
>> and on W7 32 bits (on Kubuntu the compiler version is too old)
>> -std=gnu++14
> 
> Is that kubuntu machine updated?

Of course, yes.
But it uses the gcc 4.9 version, which does not support gnu++14.

 Did it build with -std=c++11 on
> kubuntu 14.04 LTS?
> 
>>
>> but on W7 32 bits the option
>> -std=c++11
>> does not work (compil errors)
> 
> I think I tested Simon's original patch on msys2 on 64 and it seemed
> to work. What errors do you see?
> 
>>
>> Therefore, with gcc:
>> -std=gnu++11 is OK
>> -std=c++11 is not acceptable
>>
>> (This is not the first time i have issues with option -std=c++11 or
>> -std=c++14 and no issue with -std=gnu++11 or -std=gnu++14)
>>
>>
>> --
>> Jean-Pierre CHARRAS

After more tests:

- During my first test, I did not applied the patch. I just forced the
option -std=c++11 when calling cmake.

I had some issues (like M_PI dot defined, although math.h was included,
and more other issues)

- After your response, I applied the patch. and I was able to build Kicad.

- Because this is a bit strange, I had a look at this issue:
Although there is in this patch the line:
"set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")"
when make is run the actual option (try make VERBOSE=1) is "-std=gnu++11"

So no more mystery, as I wrote:
-std=gnu++11 works, -std=c++11 does not work.

I am saying "no more mystery", but this is not fully true:
the option
"set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")" becomes actually:
"set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")"

And this change is a mystery, at least for me (but I have a poor
knowledge of cmake).

-- 
Jean-Pierre CHARRAS


Follow ups

References